知道为什么吗?
Q78
What is the result of attempting to compile and run the following program
1. public class Test {
2. public void method(Object o) {
3. System.out.println("Object Version");
4. }
5. public void method(String s) {
6. System.out.println("String Version");
7. }
8. public static void main(String args[]) {
9. Test test = new Test();
10. test.method(null);
11. }
12. }
Select one correct answer
a. The code does not compile.
b. The code compiles cleanly and shows "Object Version".
c. The code compiles cleanly and shows "String Version".
d. The code throws an Exception at Runtime.
Answer:c
Q79
What is the result of attempting to compile the following program
1. public class Test {
2. public void method(StringBuffer sb) {
3. System.out.println("StringBuffer Verion");
4. }
5. public void method(String s) {
6. System.out.println("String Version");
7. }
8. public static void main(String args[]) {
9. Test test = new Test();
10. test.method(null);
11. }
12. }
Select one correct answer
a. The code does not compile.
b. The code compiles correctly and shows "StringBuffer Version".
c. The code compiles correctly and shows "String Version".
d. The code throws an Exception at Runtime
Answer:a.
请详细解释: