Home Tutorial Java Scjp Part7 SCJP Module-7 Question-9

 
 

SCJP Module-7 Question-9
Posted on: July 14, 2010 at 12:00 AM
This example will check your understanding about the wrapper class Integer and it is also very helpful for successful completion of SCJP exam.

Given a sample code:

1    public class Test {
2    public static void main(String[] args) {
3    Integer i = 5;
4    int j = i.intValue();
5    System.out.println(j);
}}

What will be the result of above code ?

(A) 5
(B) An exception is thrown at runtime.
(C) Compilation fails because of an error on line 3.
(D) Compilation fails because of an error on line 4.

Answer:

(A)

Related Tags for SCJP Module-7 Question-9:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.