0
How do I use JOptionPane for Strings?
When I use JOptionPane.showInputDialog than I use ....charAt(0) for char and Double.ParseDouble and so on. What do I use for Strings? For example: If I want sb. to enter their name in the Input Dialog and if its equal to a specific name I entered, it must show sth else as if its an other name
1 Réponse
+ 11
The input of JOptionPane is by default in String, you don't need to convert it again.
String name = JOptionPane.showInputDialog("Enter your name: ");
if(name.equals("Julien")){
// write something
}