Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General 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