This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

illegal start of expression

 
Don Williams
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following errors are what I'm getting when I compile this program. Can you help, no matter what I try, it still comes up error.

Thanks


C:\Sun\AppServer\jdk\bin\Temperature.java:57: illegal start of expression
public double read()//<---------------------HERE^
C:\Sun\AppServer\jdk\bin\Temperature.java:162: illegal start of expression
private char myScale;//<----------------------------HERE
^
2 errors

Tool completed with exit code 1


 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look for mismatched curly braces real close to your error messages. Do you have an editor that can format code or identify matching (or non-matching) braces? If not, maybe the gang will recommend one.
[ June 06, 2006: Message edited by: Stan James ]
 
fred rosenberger
lowercase baba
Bartender
Posts: 12180
34
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
look carefully at the braces in your public boolean read() method
 
Rudy Rusli
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you have too much open curly braces in public boolean read().
Also, I think you should remove one of the curly braces at the very bottom.
 
Steve Fahlbusch
Bartender
Posts: 605
7
Mac OS X Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And no having two methods with the same name in a class that differs only by the return value - think like the compiler - what will be returned by a read()? a boolean or a double?
 
Don Williams
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the help.
 
stephen shields
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well rudy rusli is correct you do have errors with your curly brases
there is an extra "{" after keyboard k = new keyboard();
indent your braces and you should always be able to catch one out of place.
also let the java ide insert them for you
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And no having two methods with the same name in a class that differs only by the return value - think like the compiler - what will be returned by a read()? a boolean or a double?


That will be the next error. The fun never ends.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic