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

 
 

Share on Google+Share on Google+
SCJP Module-7 Question-5
Posted on: July 13, 2010 at 12:00 AM
Advertisement
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)

Advertisement

Related Tags for SCJP Module-7 Question-5:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: July 13, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com