mercredi 20 mai 2015
If-anweisung per ja eingabe.
Posted on 11:37 by verona
Ich möchte per Tastatur ja eingeben damit die if anweisung Jawollo herausgibt.
Wenn ich also ja eingebe gibt mir das Programm falsche antwort heraus.
Gebe ich nun in der if anweisung c == ´a´ ein, so funktioniert das Programm einwandfrei.
Hat jemand eine Idee wie ich dieses Problem lösen kann?
Wenn ich also ja eingebe gibt mir das Programm falsche antwort heraus.
Java Code:
-
import javax.swing.JOptionPane;
-
-
-
-
public class If {
-
-
-
// TODO Auto-generated method stub
-
-
String eingabe;
-
char c;
-
-
c = eingabe.charAt(0);
-
-
if (c == 'j' + 'a') {
-
}
-
-
else {
-
{
-
}
-
-
-
}
-
}
-
}
Gebe ich nun in der if anweisung c == ´a´ ein, so funktioniert das Programm einwandfrei.
Java Code:
-
}
Hat jemand eine Idee wie ich dieses Problem lösen kann?
If-anweisung per ja eingabe.
Categories: If-anweisung per ja eingabe.
Inscription à :
Publier les commentaires (Atom)
0 commentaires:
Enregistrer un commentaire