Program to pass arguments while throwing checked exception in Java
public class Main {
public static void main (String args[]) {
try {
throw new Exception("throwing an exception");
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
Output:
throwing an exception
