0
Exception
Hi class. InnJava, if I define and array of ints : int arr[] = new int[4]; then I assign using try-catch block arr[8] = 40l/0; what kind of error' Will be generated? ArithmaticException or ArrayIndexOutOfBound exception? Which one Will be checked first by Java JVM?
2 Antworten
+ 4
Test it in your compiler to see.
+ 3
Right side operations always happens first so 40 / 0 will execute first
Now you know which exception will come.