aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Please tell me where is the error in this program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Please tell me where is the error in this program" Watch "Please tell me where is the error in this program" New topic
Author

Please tell me where is the error in this program

Jacob Sonia
Ranch Hand

Joined: Jun 28, 2009
Posts: 174
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18896
    
  40


hmmm.... Would it not be a good idea to use javac to report on the error? Or are you looking for something specific?

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
karthick chinnathambi
Ranch Hand

Joined: Jul 06, 2009
Posts: 196


Jacob Sonia wrote:ExceptionHierarchy e = new ExceptionHierarchy();



you have declared ExceptionHierarchy as inner class.... so it can't live without the object of the enclosing class.....
try new Exception().new ExceptionHierarchy().....
but this type of coding is a bad idea i suppose............


KARTHICK.C , SCJP6-93%
(Born to Win)
Mo Jay
Ranch Hand

Joined: Feb 16, 2009
Posts: 83
Because you didn't instantiate the outer class MyException first and you tried to instatiate the inner class, you need to do something like this:


By the way, you need to quote your source for this code and say where you got it from.

Cheers!!!
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6662
    
    5

Is there any specific error that you are looking to resolve ? If you type in a few words you are likely to get a better response to your question


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
 
wood burning stoves
 
subject: Please tell me where is the error in this program