J
JavaIstManchmalSchwer
Gast
Hi,
will in einer if-Anweisung prüfen, ob eine bestimmte Eingabe getätigt wurde, doch klappt das auf meine Art irgendwie nicht. Habe zwar schon in der SDK geschaut, doch weiß ich nicht wie ich das fehlende Ende abfangen soll ...
"A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached"
Hier mein Code-Sample:
Kann mir jmd helfen?
bye
will in einer if-Anweisung prüfen, ob eine bestimmte Eingabe getätigt wurde, doch klappt das auf meine Art irgendwie nicht. Habe zwar schon in der SDK geschaut, doch weiß ich nicht wie ich das fehlende Ende abfangen soll ...
"A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached"
Hier mein Code-Sample:
Code:
public static void main(String[] args) throws IOException {
BufferedReader eingabe = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Ihre Eingabe: ");
String a = eingabe.readLine();
System.out.print(a);
if(a == "x")
System.out.println("Ausgabe ist OK!");
else
System.out.println("Nichts passiert");
}
Kann mir jmd helfen?
bye