Results 1 to 5 of 5
  1. #1
    Chinese is offline Member
    Join Date
    Dec 2015
    Posts
    5
    Rep Power
    0

    Default Guys I need help

    Hi, I'm fairly new to java and need help on my code. I keep getting the same error help me guys :(

    Java Code:
    import javax.swing.JOptionPane;
     public class act01
     {
       public static void main(String[]Args)
       {
         String Surname,FirstName,MiddleName,Birthplace,Birthdate;
         int Birthday;
         Surname=JOption.showInputDialog(null,"Input Surname");
         FirstName=JOption.showInputDialog(null,"Input Firstname");
         MiddleName=JOption.showInputDialog(null,"Input MiddleName");
         Birthdate=JOption.showInputDialog(null,"Input Birthdate");
         Birthplace=JOption.showInputDialog(null,"Input Birthplace");
         JOptionPane.showmessageDialog(null," " +Surname);
         JOptionPane.showmessageDialog(null," " +FirstName);
         JOptionPane.showmessageDialog(null," " +MiddleName);
         JOptionPane.showmessageDialog(null," " +Birthdate);
         JOptionPane.showmessageDialog(null," " +Birthplace);
       }
     }
    Errors:
    JOptionPane cannot be resolved.
    Last edited by Chinese; 12-13-2015 at 06:57 AM.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Guys I need help

    Please edit your post and wrap your code with code tags:
    [code]
    **YOUR CODE GOES HERE**
    [/code]
    to get highlighting and preserve formatting.

    What source line does the error happen on?
    Please copy the full text of the error message and paste it here. It has important info about the error.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    Location
    MA, USA
    Posts
    398
    Rep Power
    6

    Default Re: Guys I need help

    Use JOptionPane for your input Dialog.
    Interesting choice of variables for birthday and birthdate.

  4. #4
    Chinese is offline Member
    Join Date
    Dec 2015
    Posts
    5
    Rep Power
    0

    Default Re: Guys I need help

    It gives me a new error :(
    Java Code:
    import javax.swing.JOptionPane;
     public class act01
     {
       public static void main(String[]Args)
       {
         String Surname,FirstName,MiddleName,Birthplace,Birthdate;
         int Birthday;
         Surname=JOptionPane.showInputDialog(null,"Input Surname");
         FirstName=JOptionPane.showInputDialog(null,"Input Firstname");
         MiddleName=JOptionPane.showInputDialog(null,"Input MiddleName");
         Birthdate=JOptionPane.showInputDialog(null,"Input Birthdate");
         Birthplace=JOptionPane.showInputDialog(null,"Input Birthplace");
         JOptionPane.showmessageDialog(null," " +Surname);
         JOptionPane.showmessageDialog(null," " +FirstName);
         JOptionPane.showmessageDialog(null," " +MiddleName);
         JOptionPane.showmessageDialog(null," " +Birthdate);
         JOptionPane.showmessageDialog(null," " +Birthplace);
       }
     }
    Errors:
    5 errors found:
    File: F:\2nd quarter\act01.java [line: 13]
    Error: The method showmessageDialog(null, java.lang.String) is undefined for the type javax.swing.JOptionPane
    File: F:\2nd quarter\act01.java [line: 14]
    Error: The method showmessageDialog(null, java.lang.String) is undefined for the type javax.swing.JOptionPane
    File: F:\2nd quarter\act01.java [line: 15]
    Error: The method showmessageDialog(null, java.lang.String) is undefined for the type javax.swing.JOptionPane
    File: F:\2nd quarter\act01.java [line: 16]
    Error: The method showmessageDialog(null, java.lang.String) is undefined for the type javax.swing.JOptionPane
    File: F:\2nd quarter\act01.java [line: 17]
    Error: The method showmessageDialog(null, java.lang.String) is undefined for the type javax.swing.JOptionPane

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,422
    Blog Entries
    7
    Rep Power
    28

    Default Re: Guys I need help

    Read the error messages: there is no method named 'shomessageDialog' that takes two parameters: null and String; read the API documentation for the JOptionPane class and see what methods are available.

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

Similar Threads

  1. Guys help please!!!
    By terrificstudent4444 in forum New To Java
    Replies: 1
    Last Post: 10-30-2013, 06:04 AM
  2. Hi Guys.
    By creperz in forum Introductions
    Replies: 2
    Last Post: 07-03-2013, 10:52 AM
  3. Hello guys
    By amzers in forum New To Java
    Replies: 4
    Last Post: 07-23-2011, 07:44 PM
  4. Guys please i need help !!! :d
    By omar_6630 in forum New To Java
    Replies: 7
    Last Post: 11-23-2010, 01:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •