Task 1: Exception handling public class Test { public static void main(String args[]){ int d = 0; int n = 20; int fracti

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Task 1: Exception handling public class Test { public static void main(String args[]){ int d = 0; int n = 20; int fracti

Post by answerhappygod »

Task 1: Exception handling
public class Test
{
public static void main(String args[]){
int d =
0;
int n =
20;
int fraction = n/d;
System.out.println("End
Of Main");
}
}
public class Test
{
public static void main(String args[])
{
int d =
0;
int n =
20;
try {
int fraction = n / d;
System.out.println("This
line will not be Executed");
} catch (ArithmeticException e)
{
System.out.println("In
the catch Block due to Exception = " + e);
}
System.out.println("End
Of Main");
}
}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply