Java Program to Throw Exception
01. Example: public class throwErrorExample { static void throwErrorMethod(int number) { if (number < 0){ throw new ArithmeticException("There is something wrong."); } else{ System.out.println("Check positive and negative number."); } } …