Featured Post

Step Wise Project Planning

Planning is the most difficult process in project management. The framework described is called the Stepwise method to help to distinguis...

  1. Home

Write a program of Exception Handling in Java.

Write a program of  Exception Handling in Java.

package abc;

import java.io.IOException;
import java.io.*;
/**
 *
 * @author Student
 */
public class Abc {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)
    throws IOException{
        int a,b,c = 0,d;
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        System.out.println("enter 2 no");
        a=Integer.parseInt(br.readLine());
        b=Integer.parseInt(br.readLine());
        try{
            d=a/b;
            System.out.println(c);// TODO code application logic here
    }
        catch(ArithmeticException e)
        {
            System.out.println("2 no is zero");
        }
    }}
Previous
Next Post »