Task 1: Exception handling public class Test { public static void main(String args[]){ int d = 0; int n = 20; int fracti
Posted: Sat May 14, 2022 3:34 pm
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");
}
}
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");
}
}