
Write a java program to divide 2 numbers. Avoid division by zeor by catching the exception.

class Divide
{
public static void main(String[] args)
{
try{
int num1=8;
int num2=4;
int div=num1/num2;
System.out.println(div);
}
catch(Exception e){
System.out.println(e);
}
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
