试题详情
- 单项选择题ClassOne.java: 1. package com.abe.pkg1; 2. public class ClassOne { 3. private char var = ‘a’; 4. char getVar() { return var; } 5. } ClassTest.java: 1. package com.abe.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 fails.
B、 Compilation succeeds and no exceptions are thrown.
C、 An exception is thrown at line 5 in ClassTest.java.
D、 An exception is thrown at line 6 in ClassTest.java.
- A
关注下方微信公众号,在线模考后查看
热门试题
- Under which&ens
- 下面哪些main方法可用于程序执行()
- Component类有何特殊之处?其中定
- public class&e
- HTTP中的POST和GET在下列哪些方
- What is th
- 以下哪种初始化数组的方式是错误的?()
- 1. public&ensp
- 已知: 该输出是?()
- public class&e
- 以下关于GUI容器缺省布局管理器的叙述,
- Given: Intege
- import java.ut
- What is th
- Given a
- JDK工具javadoc的作用是哪项?(
- 现有包结构: com&en
- UML图只能显示类的成员函数和变量,不能
- What the o
- class Top&ensp