Help please, new to Java

Discussion in 'Java' started by Piddlyjinks, Apr 25, 2012.

  1. Piddlyjinks

    Piddlyjinks

    Joined:
    Apr 25, 2012
    Messages:
    1
    Assume this is part of a method in a well-formed class. What's wrong with this snippet?

    String age = JOptionPane.showMessageDialog("What is your age?");
    int age = Integer.parseInt(age);

    System.out.println("Age is: " + age);
    Piddlyjinks, Apr 25, 2012
    #1
    1. Advertising

  2. Piddlyjinks

    Spidy

    Joined:
    Apr 29, 2012
    Messages:
    1
    I am still pretty new to Programming but it may help not sure if this is right but worth a try. From what ive learned always make the first Character lowercase so it doent think its a class

    String age = J <--- change that to j -OptionPane.showMessageDialog("What is your age?");
    int age = I <-- and that to i - nteger.parseInt(age);

    System.out.println("Age is: " + age);




    so now it will look like


    String age = jOptionPane.showMessageDialog("What is your age?");
    int age = integer.parseInt(age);

    System.out.println("Age is: " + age);




    not sure if thats correct but like i said its worth a shot really hope it helps! :)
    [​IMG]
    [​IMG]
    Spidy, Apr 29, 2012
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. queen
    Replies:
    3
    Views:
    6,569
    queen
    Jul 15, 2004
  2. casioculture@gmail.com
    Replies:
    4
    Views:
    490
    Chris Uppal
    May 5, 2005
  3. KK
    Replies:
    2
    Views:
    515
    Big Brian
    Oct 14, 2003
  4. MuZZy
    Replies:
    7
    Views:
    1,716
    Mike Hewson
    Jan 7, 2005
  5. weblinkunlimited@gmail.com

    Javascript new-new-new-new-newbee

    weblinkunlimited@gmail.com, Mar 10, 2008, in forum: Javascript
    Replies:
    2
    Views:
    436
    Thomas 'PointedEars' Lahn
    Mar 11, 2008
Loading...

Share This Page