Consider the following Java program. What is the output of the program? class A { int x = 10; } class B extends A { int x = 20; public static void main(String[] args) { A obj = new B(); System.out.print(obj.x); } }单项选择题

题目图片
A

A. Compilation error

B

B. 10

C

C. Runtime error

D

D. 20

登录即可查看完整答案

我们收录了全球超50000道真实原题与详细解析,现在登录,立即获得答案。

类似问题

更多留学生实用工具

加入我们,立即解锁 海量真题独家解析,让复习快人一步!