试题详情
- 单项选择题 1.public class Test { 2.public static void main (String args[]) { 3.class Foo { 4.public int i = 3; 5.} 6.Object o = (Object) new Foo(); 7.Foo foo = (Foo)o; 8.System.out.printIn(foo. i); 9. } 10.} What is the result?()
A、 Compilation will fail.
B、 Compilation will succeed and the program will print “3”
C、 Compilation will succeed but the program will throw a ClassCastException at line 6.
D、 Compilation will succeed but the program will throw a ClassCastException at line 7.
- B
关注下方微信公众号,在线模考后查看
热门试题
- public class&e
- 求个位数是6,且能被3整除的所有四位数之
- 从键盘上输入10个整数,并将其放入一个一
- 如果一个方法或变量是"private"访
- 下面是有关子类调用父类构造函数的描述正确
- Which command&e
- 下列关于标识符的叙述正确的是哪项?()&
- 1. public&ensp
- Click the
- 已知24有8个正整数因子 (即:1,2,
- Which is
- 用JavaApplication编写一个
- 定义10个长度的Student数组,将1
- for (int
- 3. string&ensp
- A team o
- What is th
- 1. public&ensp
- Which statement
- 以下字符串函数的描述中,错误的是()