Exception

Difference between Throw and Throws in Java

In this tutorial you will learn about difference between throw and throws keywords in java with example. When we run a java program which contains errors, programmers should handle errors by exception handling (using try, catch and finally blocks) or avoid (throw) it. Otherwise JVM will give error which causes the termination of the running …

Difference between Throw and Throws in Java Read More »

java.lang.IllegalArgumentException – Reasons and How to Solve?

Here you will learn possible causes of Exception in thread “main” java.lang.IllegalArgumentException and ways to solve it. I hope you know the difference between error and exception. Error means programming mistake that can be recoverable only by fixing the application code. But exceptions will arise only when exceptional situations occurred like invalid inputs, null values, etc. …

java.lang.IllegalArgumentException – Reasons and How to Solve? Read More »

Java NullPointerException – Reasons for Exception and How to Fix?

In this tutorial you will learn about Java NullPointerException and ways to fix this. A runtime error that can be handled by the programmer is called an Exception. Some exceptions that are checked at compile time are called Checked Exceptions, these also called compile time errors. But the term we are using Exception only refers …

Java NullPointerException – Reasons for Exception and How to Fix? Read More »

Checked and Unchecked Exceptions in Java

There are two types of exceptions in Java i.e. checked and unchecked exceptions. Below I have explained about these two exceptions with examples. Checked and Unchecked Exceptions in Java Checked Exceptions Those exceptions that are checked at compilation time are called checked exceptions. Checked exception includes the classes that extend Throwable class except RuntimeException and …

Checked and Unchecked Exceptions in Java Read More »