• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Userdefined Exception

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what type of exception are occures in Userdefined exception? means copmpile time OR runtime exception
 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Userdefined exceptions are always Runtime and when you write your own exception then it should extend any java defined Runtime exceptions like Exception, FileNotFoundException etc.

Compile time errors are jdk level errors like syntax errors, identifier errors etc. Hope this helps.
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

means copmpile time OR runtime exception



Did you mean "Checked exception OR Unchecked exception"?

If either "RuntimeException re=new UserdefinedException(...)" or "Error ee=new UserdefinedException(...)" accepts without type error, UserdefinedException is unchecked exception; otherwise it is checked exception.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Compile time exceptions" don't exist. The compiler can give an error if there is something wrong with your source code, but that does not have anything to do with Java exceptions.

Your own exceptions can be either checked or unchecked exceptions. If your own exception class extends Exception, then it is a checked exception. If it extends RuntimeException, then it is an unchecked exception.
 
a fool thinks himself to be wise, but a wise man knows himself to be a fool - shakespeare. foolish tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic