File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes TrynCatch 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 » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "TrynCatch" Watch "TrynCatch" New topic


Roberto Diaz
Ranch Hand

Joined: Mar 08, 2002
Posts: 40
I have following code which works just fine.

But if I add the print statement in class B it
fails to compile.
Can anyone expalin whatz going on behind the scenes??
[ Jess added UBB [code] tags to preserve whitespace, check 'em out! ]
[ January 14, 2003: Message edited by: Jessica Sant ]
Jessica Sant

Joined: Oct 17, 2001
Posts: 4313

its actually pretty simple
the System.out.println statement needs to be inside a method or a constructor:

- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: TrynCatch
jQuery in Action, 3rd edition