Search

// write a program to handle divide by zero exception.


CODE

class Dividebyzero
{
public static void main(String s[])
{
int a =10;
int b =5;
int c =5;
int x;
try
{
x =a/(b-c);
}
catch(ArithmeticException e)
{
System.out.println("divisle by zero"+e);
}
}
}

OUTPUT DISPLAY


Share this article :
 

Post a Comment

 
Support : everytricks4.blogspot.in/ | Johny Template | Mas Template
Copyright © 2011. Computer Tricks - All Rights Reserved
Creating Website Published by
Proudly powered by Blogger