试题详情
- 单项选择题 ClassOne.java 1. package com.abc.pkg1; 2. public class ClassOne { 3. private char var = ‘a’; 4. char getVar() {return var;} 5. } ClassTest.java 1. package com.abc.pkg2; 2. import com.abc.pkg1.ClassOne; 3. public class ClassTest extends ClassOne { 4. public static void main(String[]args) { 5. char a = new ClassOne().getVar(); 6. char b = new ClassTest().getVar(); 7. } 8. } What is the result?()
A、 Compilation will fail.
B、 Compilation succeeds and no exceptions are thrown.
C、 Compilation succeeds but an exception is thrown at line 5 in ClassTest.java.
D、 Compilation succeeds but an exception is thrown at line 6 in ClassTest.java.
- B
关注下方微信公众号,在线模考后查看
热门试题
- int i =&e
- Which statemen
- 用于生成Java文档的JDK工具是?()
- 关于抽象类与最终类,下列说法错误的是()
- public class ClassA
- What is th
- 定义10个长度的Student数组,将1
- public class&e
- int index&ensp
- 哪两个是同步的?()
- 写一段代码,把List容器中的数字元素“
- 画出程序的运行结果
- 已知: 在命令行中执行 javaCDE
- 以下描述正确的是()。
- What can b
- Java语言中常量的定义是哪项?()
- 如何区分多个构造函数?()
- 有一堆桃子(个数不超过1000),如果分
- In which
- 已知: 则下面哪些语句在横线处是合法的