Try - Catch Blocks In Java

 package com.company;


public class tuts {
public static void main(String[] args) {
int a = 6000;
int b = 0;
try{
int c = a/b;
System.out.println(c);
}
catch(Exception e){
System.out.println("We can perform the division and the reason is: ");
System.out.println(e);
}
}
}

Comments

Popular posts from this blog

Creating a Thread by Extending Thread class

Constructors from Thread class in Java