2
class Demo {
    public static void main(String args[]) {        
        int a=10;
        int b=0;
        System.out.println(a/b); // runtime error

        double c=10;
        double d=0;
        System.out.println(c/d);        
    }        
}

runtime error occur when run this code from the line which i marked and that is due to divide by zero and other one works fine and its also has a divide by zero expression. what is the reason for these two different behaviors ?

Kalhan.Toress
  • 21,683
  • 8
  • 68
  • 92

0 Answers0