• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

error: not a statement, '.class' expected, illegal start of expression, ';' expected

 
Dustin Schreader
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get these error messages:

In this line: 23
In this method:
 
John Jai
Rancher
Posts: 1776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The else part is missing a opening and a closing brace {}. The firstNum variable will not be visible if the braces are not provided.
Line #21
 
Satyen Singh
Greenhorn
Posts: 21
Java Tomcat Server Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Dustin,

please, specify the exact line on which you are getting error.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12149
31
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Satyen Singh wrote:please, specify the exact line on which you are getting error.

I'm pretty sure that's what he meant when he said:
In this line: 23
In this method:

As a general note, you should indeed ALWAYS use braces, even if not technically required. And even if you DO use braces, your firstNum will go out of scope once you exit from said braces, and will not be visible by the time you enter your switch on line 32 of the provided code.
 
Dustin Schreader
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I will try using the braces, thank you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic