Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 14-11-2009
Member
 
Join Date: Jul 2009
Posts: 127
Joptionpane in java

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!");
        }
    }
}
Reply With Quote
  #2  
Old 14-11-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
Re: Joptionpane in java

Hello,
Your solution is very simple, I think even you could have found the solution by our self if you had gone through some books. But still coming to your problem, you have not import the package that is the statement "import javax.Swing.JOptionPane" is missing in the code. Include this line and you are with the result. I think you should read some books on java basic and then try to program in java. Any query in future, do post and your problem will be solved.
Reply With Quote
  #3  
Old 14-11-2009
Member
 
Join Date: Jul 2009
Posts: 127
Re: Joptionpane in java

Thanks for your help.
From now I will read the books of java basic and then try to program in java. I now this was a silly question. But still I will not forget to import the required packages from now onwards. Thanks again and if I have any query in future I will post so that it will be solved.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Joptionpane in java"
Thread Thread Starter Forum Replies Last Post
Java Auto Updater wants me to update java everyday in Windows 7 minajoh Windows Software 4 04-09-2013 11:04 PM
Use of JOptionPane class Khan Baba Software Development 5 16-02-2010 11:44 AM
How Can I Change the background Color Of A JOptionPane? Adrina_g Software Development 5 27-01-2010 09:41 AM
JOptionPane.showInputDialog size list New ID Software Development 5 19-01-2010 12:06 PM


All times are GMT +5.5. The time now is 01:40 PM.