Bookmark Topic Watch Topic
  • New Topic

difference b/w Runtime and compile time exceptions?

 
Naveen Megharaj
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Report post to moderator
how to know whether an Exception is a Runtime exception or Compile time exception....? How to differentiate between them......?its confusing me a lot.......!!!
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Report post to moderator
If its a subclass of java.lang.RuntimeException, then it means its RuntimeException. Having said that, you don't usually need to catch runtime exceptions, they wouldn't complain either. Whereas regular exceptions, you need to handle gracefully. You can refer the docs to see all the pre-defined RuntimeExceptions in Java such as, ArithmeticException, and the infamous NullPointerException.
 
Rob Spoor
Sheriff
Pie
Posts: 20545
56
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Moving to beginner's.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49367
62
  • Mark post as helpful
  • send pies
  • Report post to moderator
There is no such thing as a compile time exception. All exceptions occur at runtime. Compile time errors are different. There is a website about errors here.
 
W. Joe Smith
Ranch Hand
Posts: 710
  • Mark post as helpful
  • send pies
  • Report post to moderator
Campbell Ritchie wrote:There is no such thing as a compile time exception. All exceptions occur at runtime. Compile time errors are different. There is a website about errors here.


Nice site! If you were here, I'd give you a high five. Since you are not, I will do the distance high five in my mind.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49367
62
  • Mark post as helpful
  • send pies
  • Report post to moderator
Thank you. High fifty-five maybe to the people who compiled that site, then
 
Campbell Ritchie
Sheriff
Pie
Posts: 49367
62
  • Mark post as helpful
  • send pies
  • Report post to moderator
Closing as a duplicate of this thread. Read this FAQ.
 
    Bookmark Topic Watch Topic
  • New Topic