Help please, new to Java

Joined
Apr 25, 2012
Messages
1
Reaction score
0
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);
 
Joined
Apr 29, 2012
Messages
1
Reaction score
0
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! :)

 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top