-
Notifications
You must be signed in to change notification settings - Fork 0
Exception
Keyhan Hadjari edited this page Sep 20, 2016
·
1 revision
Exception happens because of something has not gone according to the plans, for example a resource i busy, or format of given parameter is not right or you are trying to put too many members inside an array or access a member that does not exist.
- Return codes are expected, exceptions are not.
- Error class is used for irecoverable errors. No catching, handling or declaring of errors are allowed.
- Runtime or unchecked exceptions can be fatal. Catching or handling of are allowed but not needed, the system takes care of it automatically.
- Checked exception. catching, handling or declaring of are mandatory.
- Finally is called after try and all catch blocks are passed, do not matter it any exception caught.
- Only way to make sure finally is not called is to call System.exit(0) method.
- ArithmeticException
- ArrayIndexOutOfBoundsException
- ClassCastException
- IllegalArgumentException
- NullPointerException
- NumberFormatException
- FileNotFoundException
- IOException
- ExceptionInInitializerError
- StackOverflowError
- NoClassDefFoundError