Results 1 to 3 of 3

Thread: Joptionpane in java

  1. #1
    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!");
            }
        }
    }

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    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.

  3. #3
    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.

Similar Threads

  1. Replies: 4
    Last Post: 04-09-2013, 11:04 PM
  2. Use of JOptionPane class
    By Khan Baba in forum Software Development
    Replies: 5
    Last Post: 16-02-2010, 11:44 AM
  3. How Can I Change the background Color Of A JOptionPane?
    By Adrina_g in forum Software Development
    Replies: 5
    Last Post: 27-01-2010, 09:41 AM
  4. JOptionPane.showInputDialog size list
    By New ID in forum Software Development
    Replies: 5
    Last Post: 19-01-2010, 12:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,278,478.23782 seconds with 17 queries