Java Throw Exception

The throw keyword in Java is used to “throw” an exception.

By using Java throw keyword, we can throw either checked nor unchecked exceptions. The throw keyword is mainly used to throw custom exception.

Syntax of the Java throw keyword is written below :

Continue reading Java Throw Exception

Java Exception Try-Catch

Java Exception

When running Java codes, many errors can occur; coding errors made by the programmer, wrong input, and other unforseeable things.

When an error occurs, Java will normally stop the program and generate an error message. The technical term for this is : Java will throw an exception (error).

Java try-catch

Continue reading Java Exception Try-Catch