This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
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 Java Interview Guide this week in the Jobs Discussion 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
I agree. Here's the link:
subject: TrynCatch
It's not a secret anymore!