• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

is exception extends Object class?

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I was reading about the exception ...
I have a doubt whether class Exception extends Object class?
why am i asking this because it is given in the K&R book ,that exception are always some subclass of java.lang.Exception ...

Is Exception is an object?

can any body please answer my Question..

Thanks,
Vinay Rajnish
 
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by vianyrajnish rajnish:
Hi all,
I was reading about the exception ...
I have a doubt whether class Exception extends Object class?


It does -- or at least, it extends Throwable, which extends Object. Have a browse of the API docs:

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Exception.html
 
lowercase baba
Posts: 13081
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
EVERY object is a decendant of object. You can always go to the Sun API, and look up the object in question. There, you would see this:


So, exception extends throwable, which extends Object.
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In java object class is the base class for all classes created. Exception as mentioned above extnds throwalbe and which in trun extneds object class.

Even the classes created (even in your program) implicilty extneds the object class if no extends clasue is provided explicilty.
 
vianyrajnish rajnish
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

Thanks for reply and providing the reference for java doc.

thanks,
Vinay Rajnish
 
yeah, but ... what would PIE do? Especially concerning this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic