import java.util.*;
public class pro31
{
public static void main(String ar[])
{
Scanner sc=new Scanner(System.in);
int a,b;
try
{
System.out.println("sum is "+(1/0));
}
catch(ArithmeticException e )
{
System.out.println("Enter a");
a=sc.nextInt();
System.out.println("Enter b");
b=sc.nextInt();
System.out.println("sum is "+(a+b));
System.out.println(e.getMessage());
}
finally
{
System.out.println("finally its run well");
}
}
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.