Home Tutorial Java Scjp Part4 SCJP Module-4 Question-16

 
 

Share on Google+Share on Google+
SCJP Module-4 Question-16
Posted on: July 10, 2010 at 12:00 AM
Advertisement
The program given below tests your understanding of method overloading in Java and also help you for SCJP exam.

Given below the sample code :

public class Question15 {

public static void main(String[] args) {

check1(1, 1.00f, '1'); check1(new Integer(1), new Float(1.00),
new Character('1')); }

static void check1(int a, float b, char c){
System.out.println("Primitive types"); }

static void check1(Integer a, Float b, Character c){
System.out.println("Reference types"); }
}

What will be the output of the following code :

1. The program will result in compilation errors telling that the definition of method test1 is duplicated.
2. The program will output 'Primitive types Reference types'.
3. The program will output 'Reference types Primitive types'.
4. The program will output 'Reference types Reference types'.

Answer :

(2)

Advertisement

Related Tags for SCJP Module-4 Question-16:


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 10, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com