This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Need help with code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Need help with code" Watch "Need help with code" New topic

Need help with code

Ron Khoe

Joined: Sep 06, 2008
Posts: 3
I need help with a project I am working on for school, what I need to do is create an application that helps a user select an ice cream cone flavor and how many scoops on the come. I managed to get the IceCreamconeException file to compile, however, I get error messages that states that an identifier is expected on about five lines when I try to compile the IceCreamCone file.Can anyone tell me exactly what this error message means. Any and all suggestions would be greatly appreciated, here are the error messages:

C:\Users\Owner\Documents\213191d_Ch15\Chapter.15>javac <identifier> expected
inputString = JOptionPane.showInputDialog(null, "What flavor of ice cream wou
ld you like?");
^ <identifier> expected
flavor = inputString;
^ <identifier> expected
inputString = JOptionPane.showInputDialog(null, "How many scoops of ice crea
m woul you like on your cone?");
^ <identifier> expected
scoops = Integer.parseInt(inputString);
^ illegal start of type
^ <identifier> expected
JOptionPane.showMessageDialog(null, "You chose" + flavor + "with" + scoops +
"of ice cream");

6 errors

[edit]Delete excess blank lines. CR[/edit]
[ December 03, 2008: Message edited by: Campbell Ritchie ]
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
those lines need to be inside a method (or constructor),
not dangling out amongst the class fields
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 45292
You appear not to have taken note of what I told you yesterday about the setScoops method.
I agree. Here's the link:
subject: Need help with code
It's not a secret anymore!