[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 739
  • Last Modified:

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.
0
KaranGupta
Asked:
KaranGupta
1 Solution
 
CEHJCommented:
There is no such Exception class. What you want is ArithmeticException
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now