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

 
 

SCJP Module-7 Question-5
Posted on: July 13, 2010 at 12:00 AM
This sample program will test your understanding about the Integer class and int data types in Java.

Given a sample code:

1    public class Test2 {
2    public static void main(String[] args) {
3    int i = 1;
4    Integer I = new Integer(i);
5    method(i);
6    method(I);
7    }

8    static void method(Integer I) {
9    System.out.print(" Wrapper");
10   }

11    static void method(int i) {
12    System.out.print(" Primitive");
}}

What will be the result of above code ?

(1) Primitive Wrapper
(2) Wrapper
(3) Primitive
(4) Wrapper  Primitive

Answer:

(1)

Related Tags for SCJP Module-7 Question-5:


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.