Try catch blocks for handling Exceptions.
package com.company;
public class CWH_80_try {
public static void main(String[] args) {
int a=6000;
int b=120;
try {
int c = a / b;
System.out.println("The result is "+ c);
}
catch(Exception e){
System.out.println("We are failed to divide. Reason: ");
System.out.println(e);
}
System.out.println("Ending!!!!");
}
}
Comments
Post a Comment