public class Foo {
private Foo(Object o) {
System.out.println("object");
}
private Foo(String s) {
System.out.println("string");
}
public static void main(String[] args) {
new Foo(null);
}
}
Can you figure out the output? object or string
1, if you don’t know the result, it shouldn’t frustrate you.
It may stir up your interest to delve into the heart of Java.
You can turn to Java Puzzlers by Joshua Bloch
By the way ,have you wondered why programmers got used to use “Foo”;
It’s not about what baidu/google can tell you ,but that will you ask them.
private Foo(Object o) {
System.out.println("object");
}
private Foo(String s) {
System.out.println("string");
}
public static void main(String[] args) {
new Foo(null);
}
}
Can you figure out the output? object or string
1, if you don’t know the result, it shouldn’t frustrate you.
It may stir up your interest to delve into the heart of Java.
You can turn to Java Puzzlers by Joshua Bloch
By the way ,have you wondered why programmers got used to use “Foo”;
It’s not about what baidu/google can tell you ,but that will you ask them.