cannot find symbol DivideByZeroException

Hi

When I executing the code below I am getting the error above

class MutipleCatchDemo
{	
	public void CallMultipleCatch()
	{
			try
			{
				int x = 0;
				int y = 5/x;
			}
			catch(DivideByZeroException e1)
			{
				System.out.println(e1.Message);
			}
	}
	
}

class MainClass
{
	public static void main(String args[])
	{		
		MutipleCatchDemo s = new MutipleCatchDemo();
		s.CallMultipleCatch();
	}
}

Open in new window


What is wrong with the code.
KaranGuptaAsked:
Who is Participating?
 
CEHJCommented:
There is no such Exception class. What you want is ArithmeticException
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.