Share on Google+Share on Google+

SCJP Module-4 Question-16

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 :



Posted on: July 10, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial 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.


Advertisement null