File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "TrynCatch" Watch "TrynCatch" New topic
Author

TrynCatch

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??
TIA.
[ Jess added UBB [code] tags to preserve whitespace, check 'em out! ]
[ January 14, 2003: Message edited by: Jessica Sant ]
Jessica Sant
Sheriff

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
 
Consider Paul's rocket mass heater.
 
subject: TrynCatch
 
Similar Threads
Exception
Q5 from Dan's top exam (2nd)
if finally gives an exception ?
Unreported exception Problem
throws & throw ??