中兴Java开发笔试题 JSD1304

VIP免费
2024-12-10 2 0 21.85KB 29 页 5.9玖币
侵权投诉
1.类 A,B 和 C 的定义如下:
public class A {
public void f() {
System.out.println(“A.f()”);
}
}
public class B extends A {
public void f() {
System.out.println(“B.f()”);
}
}
public class C {
public void g(A a) {
System.out.println(“g(A a)”);
a.f();
}
public void g(B b) {
System.out.println(“g(B b)”);
b.f();
}
}
运行下面程序:
C c = new C();
A a = new B();
c.g(a);
输出的结果是:()。
A. g(A a)
A.f()
B. g(A a)
B.f()
C. g(B b)
A.f()
D. g(B b)
B.f()
正确答案:B
2.执行下列语句:
int a = 0x9af700; //1001 1010 1111 0111 0000 0000
a <<= 2;
变量 a 的值为:()。
A. 0x26bdc00
B. 0xc6bdc00
C. 0x3fa0000
D. 0x7e02ffff
正确答案:A
3.下列代码的输出结果是()。
int j=0;
for(int i=0;i<100;i++){
j=j++;
}
System.out.println(j);
A.0
B.99
C.100
D.101
正确答案:A
4.请看下列代码:
public static void main(String[] args) {
< 插入代码>
set.add(new Integer(2));
set.add(new Integer(1));
System.out.println(set);
}
如果想保证程序的输出结果是[1,2],那么<插入代码>处应填入的代码是()。
A.Set set = new TreeSet();
B.Set set = new HashSet();
C.Set set = new SortedSet();
D.Set set = new LinkedHashSet();
正确答案:A
5.列代码的运行结果是()。
public class Forest implements Serializable {
private Tree tree = new Tree();
public static void main(String[] args) {
Forest f = new Forest();
try {
FileOutputStream fs = new FileOutputStream(“Forest.ser”);
ObjectOutputStream os = new ObjectOutputStream(fs);
os.writeObject(f);
os.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
摘要:

1.类A,B和C的定义如下:publicclassA{publicvoidf(){System.out.println(“A.f()”);}}publicclassBextendsA{publicvoidf(){System.out.println(“B.f()”);}}publicclassC{publicvoidg(Aa){System.out.println(“g(Aa)”);a.f();}publicvoidg(Bb){System.out.println(“g(Bb)”);b.f();}}运行下面程序:Cc=newC();Aa=newB();c.g(a);输出的结果是:()。A.g(...

展开>> 收起<<
中兴Java开发笔试题 JSD1304.docx

共29页,预览2页

还剩页未读, 继续阅读

声明:本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。玖贝云文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知玖贝云文库,我们立即给予删除!
分类:计算机 价格:5.9玖币 属性:29 页 大小:21.85KB 格式:DOCX 时间:2024-12-10

开通VIP享超值会员特权

  • 多端同步记录
  • 高速下载文档
  • 免费文档工具
  • 分享文档赚钱
  • 每日登录抽奖
  • 优质衍生服务
/ 29
客服
关注