- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
第2章 数据类型和运算符
[Part] 复习题
1. pre现有:
public class Wrench2 {
int size;
public static void main(String[] args) {
Wrench2 w = new Wrench2();
w.size = 11;
Wrench2 w2 = Wrench2.go(w, w.size);
System.out.println(w2.size);
}
static Wrench2 go(Wrench2 wr, int s){
s = 12;
return wr;
}
}
结果为:
/pre
(A) 11 (B) 12
(C) 编译失败。 (D) 运行时异常被抛出
2. 下列哪项不是int类型的字面量?
(A) \u03A6 (B) 077 (C) 0xABBC (D) 20
3. pre现有:
public class Test4 {
public static void main(String[] args) {
boolean x = true;
boolean y = false;
short z = 42;
if ((z++ == 42) (y = true))
z++;
if ((x = false) || (++z == 45))
z++;
System.out.println(z= + z);
}
}
结果为:
/pre
(A) z=42 (B) z=44 (C) z=45 (D) z=46
4. pre现有如下五个声明:
Line1:int a_really_really_really_long_variable_name=5;
Line2:int _hi = 6;
Line3:int big = Integer.getInteger(7);
Line4:int $do1lars = 8;
Line5:int %percent = 9;
哪行无法通过编译?
/pre
(A) Linel (B) Line3 (C) Line4 (D) Line5
5. pre现有:
Class Top {
static int x = 1;
public Top(int y) {
x *= 3;
}
}
public class Middle extends Top {
public Middle() {
x += 1;
}
public static void main(String[] args) {
Middle m = new Middle();
System.out.println(x);
}
}
结果为:
/pre
(A) 1 (B) 2 (C) 3 (D) 编译失败
6. pre
现有:
public class Test2 {
public static void main(String[] args) {
short a, b, c;
a = 1;
b = 2;
c = a + b;
a += 2;
}
}
以上代码中,哪一句是错误的?
/pre
(A) a = 1; (B) c = a + b;
(C) a += 2; (D) short a, b, c;
7. 表达式:1 - 2 / 5 + 2 * 5 的结果是哪项?
(A) 10.6 (B) 9.8 (C) 9 (D) 11
8. pre现有:
public class Passer {
static final int x = 5;
public static void main(String[] args) {
new Passer().go(x);
System.out.println(x);
}
void go(int x) {
System.out.print(x++);
}
}
结果是什么?
/pre
(A) 55 (B) 56 (C) 65 (D) 66
9. 下列哪项不是Java语言的关键字?
(A) goto (B) sizeof
(C) instanceof (D) volatile
10. 基本数据类型float的包裹类是哪项?
(A) Integer (B) Double
(C) Float (D) Character
11. pre现有:
public class Wrench {
public static void main(String[] args) {
Wrench w = new Wrench();
Wrench w2 = new Wrench();
w2 = go(w, w2);
文档评论(0)