Question: What is output? public class Division { public static double division ( double a , double b ) throws Exception { if ( b =

What is output?
public class Division{
public static double division(double a, double b) throws Exception {
if(b ==0)
throw new Exception("Invalid number.");
return a / b;
}
public static void main(String[] args){
try {
System.out.println("Result: "+ division(5,0));
}
catch (ArithmeticException e){
System.out.println("Arithmetic Exception Error");
}
catch (Exception except){
System.out.println("Division by Zero");
}
catch(Throwable thrwObj){
System.out.println("Error");
}
}
}
Arithmetic Exception Error
Division by Zero
Error
Division by Zero
Arithmetic Exception Error
Error

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!