Java-Division durch Null löst keine ArithmeticException aus – warum?Java

Java-Forum
Guest
 Java-Division durch Null löst keine ArithmeticException aus – warum?

Post by Guest »

Warum löst dieser Code keine ArithmeticException aus? Schauen Sie mal rein:

Code: Select all

public class NewClass {

public static void main(String[] args) {
// TODO code application logic here
double tab[] = {1.2, 3.4, 0.0, 5.6};

try {
for (int i = 0; i < tab.length; i++) {
tab[i] = 1.0 / tab[i];
}
} catch (ArithmeticException ae) {
System.out.println("ArithmeticException occured!");
}
}
}

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post