I heard there is difference between compile time exceptions and checked exceptions.But, logically couldn't find any .Please help
-
2Have you ever used google? – Andremoniy Nov 19 '15 at 10:08
-
2A compile time exception IS a checked exception.... – Woody Nov 19 '15 at 10:08
-
2There is no "compile time exceptions" – Andremoniy Nov 19 '15 at 10:09
-
i was confused before as unchecked exceptions are referred run time exceptions same way ,checked exceptions also called as compile time exceptions .But, Now all is clear,that officially we have only checked and unchecked exceptions .Rest, are synonyms as per their behavior . – himanshu sharma Nov 19 '15 at 10:34
2 Answers
A common misconception is that all errors are exceptions. When a new user sees an error or stack trace it must be an exception. However this is not the case. You can get
- compile time errors such as syntax errors which are not exceptions in any sense.
- exception which occur in the compiler it self. This is not due to an error in your code but a bug in the compiler.
- a stack trace for debugging purposes which is not an error. It's just a stack trace of where the program was when something happened.
Most likely, the person was confused about what is an error reported by the compiler and an actual error which occurs when you run the program.
P.S. It is unlikely but the person could have been thinking that "Checked Exception" usually refers to Exception
or sub-classes which are not RuntimeException
or sub-classes.
This is not all Throwable which are checked at compile time. In fact all Throwable are checked exception RuntimeException and Error and their sub-classes. This means you can sub-class Throwable (which is almost never used) or create Throwable itself, which is almost never thrown and only used for logging.

- 525,659
- 79
- 751
- 1,130
Checked exceptions are checked at compile-time. It means if a method is throwing a checked exception then it should handle the exception using try-catch block or it should declare the exception using throws keyword, otherwise the program will give a compilation error. It is named as checked exception because these exceptions are checked at Compile time.
There is no difference between compile time exceptions and checked exceptions

- 317
- 1
- 5
- 16
-
1
-
yes, I know, I mean the checked exceptions which are checked at compile-time. – Mukesh Kumar Nov 19 '15 at 10:12
-
1