Hi everyone
I am new to java, and this might be my third or fourth program. I am trying to solve a problem, the problem might sound silly to you because I do not have much knowledge about java. I have a problem with the joptionpane line. I do not now why it is giving an error. I have copied it from a book. Please help me.
Code:
public class EG02
{
//main method (function)
public static void main(String[] args)
{
String input;
input = JOptionPane.showInputDialog ("What's your name?");
if(input.equals("don't know"))
{
System.out.println("Congratulations!");
} else
{
System.out.println("Sorry, you lose!");
}
}
}
Bookmarks