• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please tell me where is the error in this program

 
Jacob Sonia
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Henry Wong
author
Marshal
Pie
Posts: 21003
77
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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

Henry
 
karthick chinnathambi
Ranch Hand
Posts: 196
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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............
 
Mo Jay
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic