Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
548 B
3
Indexable
Never
public static void main(String[]args)
{
	int a,b;
	double c;
	Scanner in = new Scanner(System.in);
	System.out.println("Enter 1st number");
	a=in.nextInt();
	System.out.println("Enter 2nd number");
	b=in.nextInt();
	try
	{
		c=a/b;
		System.out.println("Division="+c);
	}
	catch(ArithmeticException e)
	{
		System.out.println("Divide by zero error");
		System.out.println(e.getLocalizedMessage());
	}
	finally
	{
		System.out.println("Inside finally block");
	}
	System.out.println("Outside try-catch-finally block");
}
}