The program given below tests your understanding of method overloading in Java and also help you for SCJP exam.
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'.
(2)