
what is output of this program & why
class Test { public void display(String msg) { system.out.println(msg); } public void display(Object msg) { system.out.println(msg); }
} Class TestDemo { new Test().display(null); }

Hello Friend,
class Test {
public void display(String msg) {
System.out.println(msg);
}
public void display(Object msg) {
System.out.println(msg);
}
}
class TestDemo {
public static void main(String[]args){
new Test().display(null);
}
}
The above code displays the output null as we have called the method display() of Test class and passed null as the parameter.
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.