试题详情
单项选择题 10. public class ClassA {  11. public void methodA() {  12. ClassB classB = new ClassB();  13. classB.getValue();  14. }  15. }  And:  20. class ClassB {  21. public ClassC classC;  22.  23. public String getValue() {  24. return classC.getValue();  25. }  26. }  And:  30. class ClassC {  31. public String value;  32.  33. public String getValue() {  34. value = “ClassB”;  35. return value;  36. }  37. }  Given:  ClassA a = new ClassA();  a.methodA();  What is the result?()

A、 Compilation fails.

B、 ClassC is displayed.

C、 The code runs with no output.

D、 An exception is thrown at runtime.

  • D
  • 关注下方微信公众号,在线模考后查看

热门试题