Hey Leute,
habe ein Problem mit Eclipse
Es Kompiliert fehlerfrei, doch dann kommt das:
Geben sie das erste Wort ein: //Ausgabe
hallo //Ausgabe
Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Unknown Source)
at java.util.Scanner.next(Unknown Source)
at java.util.Scanner.nextInt(Unknown Source)
at java.util.Scanner.nextInt(Unknown Source)
at K15_AG3.main(K15_AG3.java:13)
Habe es auch schon mit dem BufferedReader versucht jedoch kamen auch fehler
Geben sie das erste Wort ein: //Ausgabe
hallo //Ausgabe
Exception in thread "main" java.lang.NumberFormatException: For input string: "hallo"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at K15_AG3.main(K15_AG3.java:14)
--------------------------------------------------------------------------
Eclipse Kepler 64-Bit
JDK 64-Bit
Windows 7 64-Bit
habe ein Problem mit Eclipse
Java:
import java.util.*;
public class K15_AG3 {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int wort1,wort2;
int zaehler=1;
System.out.println("Geben sie das erste Wort ein:");
wort1 = scan.nextInt();
System.out.println("Geben sie das zweite Wort ein:");
wort2 = scan.nextInt();
System.out.println();
System.out.print(wort1);
while( zaehler <= 30 )
{
System.out.print(".");
}
System.out.print(wort2);
}
}
Es Kompiliert fehlerfrei, doch dann kommt das:
Geben sie das erste Wort ein: //Ausgabe
hallo //Ausgabe
Exception in thread "main" java.util.InputMismatchException
at java.util.Scanner.throwFor(Unknown Source)
at java.util.Scanner.next(Unknown Source)
at java.util.Scanner.nextInt(Unknown Source)
at java.util.Scanner.nextInt(Unknown Source)
at K15_AG3.main(K15_AG3.java:13)
Habe es auch schon mit dem BufferedReader versucht jedoch kamen auch fehler
Geben sie das erste Wort ein: //Ausgabe
hallo //Ausgabe
Exception in thread "main" java.lang.NumberFormatException: For input string: "hallo"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at K15_AG3.main(K15_AG3.java:14)
--------------------------------------------------------------------------
Eclipse Kepler 64-Bit
JDK 64-Bit
Windows 7 64-Bit