Like Us

header ads

Throws Exception Example

package java_training;

public class Throwsexception {
 void division()throws ArithmeticException {
int a=45,b=0,rs;
System.out.println("\n\tThe result is :");
 }
 public static void main(String args []) {
Throwsexception T = new Throwsexception();
try {
T.division();
}
catch(ArithmeticException Ex) {
System.out.println("\n\tError:");
}
System.out.println("\n\tEnd the program");
 }
 }

Post a Comment

0 Comments