java课后习题答案及部分作业答?- 百度文库

λ bitwise exclusive OR ^ λ bitwise inclusive OR | ߼ logical AND && ߼ logical OR || conditional ?

ֵ assignment = += -= *= /= %= &= ^= |= <<= >>= >>>= 9 ụֱֻ̃́ӦJavaеЩ䣿

ụֻ̃́˳ṹ䣬ѡ䣬ѭ䣬ת/ת䡣

ѡӦJavaеif,if-else,Ƕ׵if-else,switch-case ѭӦJavaеfor,while,do-while䡣 ת/תӦJavaеcontonue,break,return䡣 10 һѭʹbreak,continue,returnIJ break (ֹ)ѭ continue ѭ return

11 Ķ壬صࡣνijʼ Ķ壺һͬ͵ı**

ص㣺ͿǻͣͽӿڣÿԪصͬԪͨ[±]±()0ʼһĶ(Object)Զ () (ڴռ) ͷ (Java) ࣺһά顢ά顣

ʵ һ ѡ

1 Java,package˵һʱðIJνṹǣ B A. ļĽṹͬ B. ļĿ¼ͬ C. ļͬ D. ļСͬ

2 й췽ĵ÷ʽУȷǣ C A. һ㷽 B. ûֱӵ C. ֻͨnewԶ D. ϵͳ

3 int publicԱMAX_LENGTH,ֵΪ100

D

A. public int MAX_LENGTH=100 B. final int MAX_LENGTH=100

C. public const int MAX_LENGTH=100 D. public final int MAX_LENGTH=100 4 JavaУȷ B A. 췽ͬ

B. 췽ɳʼġ

C. 췽ֻ new ãܱûֱӵá D. 췽ûз͡

5 JavaУĸDzȷģ D A. ľ̬ڸĶ󱻴ǰ B. ľ̬ܷʸķǾ̬

C. abstract ηԳ򷽷ǰ棬ܳڱ֮ǰ D. final ηԳ֮ǰܳڷ֮ǰ 6 Javaѡ D ʵ˼Ļơ A. **. ̳ C. ̬

D. ת

7 WorkerPerson࣬Worker췽һ\䣨 C A. Workerжsuper() B. Personжsuper() C. PersonĹ캯 D. ﷨

8 Java£Test.java,ǣ C public class Test{

private static final int counter=10; public static void main(String [] args){ System.out.println(counter++); } }

A. 10 B. 11

C. D. ʱ쳣

9 Java룬ʱڣ D ִ󡣣ֻѡһ class Parent{ }

class Child extends Parent{

public static void main(String args[]){ Parent p1 = new Child(); //һ Parent p2 = new Parent(); //ڶ Child c1 = new Child(); // Child c2 = new Parent(); // } }

A. һ B. ڶ

C. D.

10 JavaУij෽ʹУ B ηκ󣬿Աʡ A. private B. protected C. public D. friendly

11 Java Уඨ壺 abstract class Shape{ abstract void draw(); }

class Square extends Shape{ }

ȷǣ B A. һгɹ

B. ShapeԱ룬Squareܱ C. SquareԱ룬Shapeܱ D. SquareShapeܱ 12 Java: class A{

public static void main(String[] args){ method(); }

static void method(){

System.out.println(\System.exit(0);

System.out.println(\} }

к,( A ) A. \B. \

C. \\D. 벻ܱ

13 ±finalηһõĽĶӦǶӦϵڴѡȷĶӦϵ C

1 A ٲ

2 B һֵͲܸ 3 Cи A. 1-A 2-B 3-C B. 1-C 2-A 3-B C. 1-B 2-C 3-A

D. 1-C 2-B 3-A 14 ³

public class ConstOver {

public ConstOver (int x, int y, int z) { } }

ĸConstOver췽 B A. protected int ConstOver (){ }

B. private ConstOver (int z, int y, byte x) { } C. public object ConstOver (int x, int y, int z) { } D. public void ConstOver (byte x, byte y, byte z) { } 15 ³ class BaseClass {

private float x = 1.0f ;

public float getVar() ( return x;) }

class Subclass extends BaseClass { private float x = 2.0f; // insert code here }

ĸӵеġ//insert code hereλЧض常ķ B A. protected float getVar (){ return x;} B. public float getVar() { return x;}

C. protected float double getVar() { return x;} D. public float getVar(float f) { return f;} 16 ָгеĽ B public class Example{

String str=new String(\ char[]ch={'a','b','c'};

public static void main(String args[]){ Example ex=new Example(); ex.change(ex.str,ex.ch);

System.out.print(ex.str+\and \ System.out.print(ex.ch); }

public void change(String str,char ch[]){ str=\ok\ ch[0]='g'; } }

A. good and abc B. good and gbc C. test ok and abc D. test ok and gbc

17 Щڴյ˵ȷ? B

ϵͷ779662525#qq.com(#滻Ϊ@) ICP20003344-4