Question 122 / 297:  What is the result of compiling and running the following code?
public class Tester {

int x = 12;

static Tester reset( Tester obj) {

obj = null;

return obj;

}

public static void main(String[] args) {

Tester o1 = new Tester();

o1 = reset(o1);

System.out.print(o1.x);

}

}

A  0
B  12
C  Compilation error
D  NullPointerException is thrown
E  Another type of exception is thrown
<< First < Previous Next > Last >>
Explanation:

o1 will refer to null

Exam Home Page
Ask
Michael Sag
Start Exam
Prateek Ashtikar
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>