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

 
 

Share on Google+Share on Google+
SCJP Module-7 Question-4
Posted on: July 13, 2010 at 12:00 AM
Advertisement
The program given below will test your knowledge about the Integer class and int data types in Java and prepares you for SCJP examination.

Given a sample code:

1    public class Test3 {

2    static void pass(int i) {
    }

3    static void pass(Integer i) {
4    System.out.println(i);
    }

5    public static void main(String[] args) {
6    pass(1);
    }
    }

What will be the result of above code ?

(1) 1
(2) Print nothing
(3) Compile time error at line no 2.
(4) Compile time error at line no 6.

Answer:

(2)

Advertisement

Related Tags for SCJP Module-7 Question-4:


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