1

I've read that exceptions in Java are differentiated by being either checked and unchecked. How does a compiler know that an exception is a checked exception?

Also since all exceptions are extending extending the class Exception - is there any flag that is set to true for the compiler to mark the exception as a checked exception...

What is happening behind the scene?

I am just curious too to know about it..

Benjamin Gruenbaum
  • 270,886
  • 87
  • 504
  • 504
user3092131
  • 41
  • 1
  • 1
  • 9

1 Answers1

1

Anything that is a RuntimeException or a subclass is unchecked.

See the Java API for more information or the Java Language Specification

tddmonkey
  • 20,798
  • 10
  • 58
  • 67
  • What you had suggested, I have already read it but did not found any solid evidence where I could say that, this is major reason...what flag or what makes it happen, I barely don't know... – user3092131 Jan 01 '15 at 14:06
  • I've updated my answer to include a link to the relevant part of the JLS, this should be your definitive evidence – tddmonkey Jan 01 '15 at 14:10