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

Inner Class Error

 
Betty Reynolds
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me why the compiler does not like the last sysout statement in the code below?
 
Jesper Ottosson
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
because it's not enclosed in any method
 
Betty Reynolds
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm already aware that if you put the sysout statement in a block or a method that it will compile, so maybe I should rephrase the question. Are the only statements allowed outside of blocks/methods declarations and assignments? If not, what other statements are allowed?
Please disregard this post. I think I now understand the class coding constraints.
[This message has been edited by Betty Reynolds (edited March 26, 2000).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic