Java OCA OCP Practice Question 2758

Question

What exceptions may the following code generate at runtime?

String s;
int i = 5;
try{
   i = i/0;
   s += "next";
}
a.   ArithmeticException
b.   DivisionByZeroException
c.   FileNotFoundException
d.   NullPointerException


a and d

Note

DivisionByZeroException does not exist. No file operations are performed here.




PreviousNext

Related