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
Posts: 20837
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Moving to beginner's.
 
Campbell Ritchie
Marshal
Posts: 53180
124
  • 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
Marshal
Posts: 53180
124
  • 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
Marshal
Posts: 53180
124
  • Mark post as helpful
  • send pies
  • Report post to moderator
Closing as a duplicate of this thread. Read this FAQ.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!