I am unable to understand why this program prints String
class AA {
void m1(Object o) {
System.out.println("Object ");
}
void m1(String o) {
System.out.println("String ");
}
}
public class StringOrObject {
public static void main(String[] args) {
AA a = new AA();
a.m1(null);
}
}
Please help me to understand how this works to print Sting rather than Object