import java.util.*;
class Demo
{
void xyz()
{
Scanner sc = new Scanner(System.in);
int a,b;
System.out.println("Enter first number : ");
a=sc.nextInt();
System.out.println("Enter second number : ");
b=sc.nextInt();
System.out.println(a/b);
System.out.println(a+b);
System.out.println("Bye");
}
}
class A
{
public static void main(String ar[])
{
System.out.println("Welcome all of you");
Demo ob= new Demo();
try
{
ob.xyz();
}
catch(ArithmeticException obj)
{
System.out.println("Can't divide by zero");
}
System.out.println("Thanks");
}
}
OUTPUT
Comments
Post a Comment