Exam Permalink:
https://www.jobilize.com/java-certification-questions
Question Permalink:
https://www.jobilize.com/how-does-division-by-zero-with-doubles-work-pedro-kowalski
Question 244 / 297:  What is the output of the following code
public class Tester {

public static void main(String[] args) {

Double d = -4.0;

try {

d /= 0;

} catch (ArithmeticException e) {

System.out.println("EXCEPTION!");

} finally {

System.out.println(d);

}

}

}

A  NotANumber
B  NaN
C  EXCEPTION! -4.0
D  -Infinity
E  EXCEPTION! 0.0
F  Compilation fails
<< First < Previous Next > Last >>
Explanation:

Doubles and floats doesn't produce ArithmeticException when dividing by 0.

Exam Home Page
https://www.jobilize.com/java-certification-questions

Oracle Certified Professional Java Programmer

Author:

Access: Public Instant Grading

Ask
Stephanie Redfern
Start Quiz
Lakeima Roberts
Start Quiz
Copy and paste the following HTML code into your website or blog.
<iframe src="https://www.jobilize.com/embed/java-certification-questions" width="600" height="600" frameborder="0" marginwidth="0" marginheight="0" scrolling="yes" style="border:1px solid #CCC; border-width:1px 1px 0; margin-bottom:5px" allowfullscreen webkitallowfullscreen mozallowfullscreen> </iframe>