• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Exception

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I got a doubt in Exceptions.Why the overriding method can
throw only ArithmeticExceptions which are not thrown by
overridden method.
thanks!
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by avn:
Hi,
I got a doubt in Exceptions.Why the overriding method can
throw only ArithmeticExceptions which are not thrown by
overridden method.
thanks!


An overridding method cannot throw a new CHECKED exception that isn't the same type or isn't a sub type of the type thrown by the original method.
An ArithmeticException isn't a checked Exception. Basically Unchecked Exceptions are subclasses of RunTimeException. A complete discussion of Checked and Unchecked Exceptions is in JLS 11.5. The complete JLS can be found here http://java.sun.com/docs/books/jls/index.html

[This message has been edited by Carl Trusiak (edited July 11, 2000).]
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the reply.But, still i am not clear.
Is it that the overriding methods can throw unchecked
exceptions which are not declared in the overridden method.
pl. reply.
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by avn:
thanks for the reply.But, still i am not clear.
Is it that the overriding methods can throw unchecked
exceptions which are not declared in the overridden method.
pl. reply.


In a word, yes!
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks! i got it.I have worked with few ex also.
 
reply
    Bookmark Topic Watch Topic
  • New Topic