I am new to java . Can anyone please help me in doing this.The below program is printing Object on console . but I can't understand why it is returning that.Please help...............
public class Main{
public static void print(Object obj){
System.out.println("Object");
}
public static void print(String str){
System.out.println("String");
}
public static void main(String[] args) {
Object s=new String("Hello World");
print(s);
}
}
public class Main{
public static void print(Object obj){
System.out.println("Object");
}
public static void print(String str){
System.out.println("String");
}
public static void main(String[] args) {
Object s=new String("Hello World");
print(s);
}
}