I think this code should give Error. But it gives me Hello as Output.
public class Main
{
    public static void main(String[] args) {
        foo(null);
    }
    public static void foo(String str){
        System.out.println("Hello");
   }
    public static void foo(Object o){
       System.out.println("Hi");
   }
}
 
    