+ 2
Guess output of this java code ...
public class Test { public void foo(String s) { System.out.println("String"); } public void foo(StringBuffer sb){ System.out.println("StringBuffer"); } public static void main(String[] args) { new Test().foo(null); } }
3 Respuestas
+ 2
u need to declar a static method
for ex: public static void foo(...){...}
and in the main function u need to create:
Test.foo(null); // class Test static
or creat a varibale before new Test()
Test t=new test();
t.foo();
0
It's an error
0
That's not the problem, try in playground.