java学习笔记课后选择答案整理_第1页
java学习笔记课后选择答案整理_第2页
java学习笔记课后选择答案整理_第3页
java学习笔记课后选择答案整理_第4页
java学习笔记课后选择答案整理_第5页
已阅读5页,还剩38页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、第一章1哪个组织负责监督审察java相关技术规格的演进? a、jcp b、apache c、eu d、w3c2java技术规格必须以何种正式文件提交审察? a、rfc b、jsr c、iso d、ieee3java的原始码扩展名为何?编译完后是哪个扩展名? a、*.txt、*.java b、*.c、*.class c、*.java、*.class d、*.cpp、*.java4对jvm来说,可执行文件案的扩展名为何? a、*.java b、*.class c、*.dll d、*.pyc5在java下载页面中,可看到jre下载选项,这是哪种jre? a、web jre b、private jre

2、 c、server jre d、public jre 6在java下载页面中,哪个下载选项安装后,会有javac编译程序可以使用? a、jdk b、jre c、javadoc d、netbeans7如果只是要运行java程序,下载程序哪个安装即可 a、jdk b、jre c、javadoc d、netbeans8java根据应用领域不同,区分为哪三大平台? a、java se b、java ee c、java me d、android 9哪些平台不在java规范之中? a、java me b、android c、ios d、avi 10以下哪些包括在jre之中? a、开发工具程序 b、java

3、 se api c、jvm d、部署技术第二章1如果在hello.java中撰写以下的程序代码:public class hello publicstaticdmain(stringargs) system.out.println(hello world);以下描述何者正确? a、执行时显示hello world b、执行时出现noclassdeffounderror c、执行时出现出现找不到主要方法的错误 d、编译失败 2如果在main.java中撰写以下的程序代码:public class main public static main(string args) system.out.pr

4、intln(hello world);以下描述何者正确? a、执行时显示hello world b、执行时出现noclassdeffounderror c、执行时出现找不到主要方法的错误 d、编译失败3如果在main.java中撰写以下的程序代码:public class main public static void main() system.out.println(helloworld);以下描述何者正确? a、执行时显示hello world b、执行时出现noclassdeffounderror c、执行时出现出现找不到主要方法的错误 d、编译失败4如果在main.java中撰写以下

5、的程序代码:public class main public static void main(string args) system.out.println(hello world);以下描述何者正确? a、执行时显示hello world b、执行时出现noclassdeffounderror c、执行时出现出现找不到主要方法的错误 d、编译失败5如果c:workspacehelloclasses中有以下原始码编译而成的main.class:public class main public static void main(string args) system.out.println(h

6、ello world);文本模式下你的工作路径是c:workspace,那么如何执行main类别? a、java c:workspacehelloclassesmain b、java helloclasses main c、java cp helloclasses main d、以上皆非6如果c:workspacehelloclasses中有以下原始码编译而成的main.class:package cc.openhome;public class main public static void main(string args) system.out.println(hello world);

7、文本模式下你的工作路径是c:workspace,那么如何执行main类别? a、java c:workspacehelloclassesmain b、java helloclasses main c、java cp helloclasses main d、以上皆非7如果有个console类别的原始码开头定义如下:package cc.openhome;public class console .其完全吻合名称为何? a、cc.openhome.console b、package.cc.openhome.console c、cc.openhome.class.console d、以上皆非正确答案

8、: a 8如果c:workspacehellosrc中有main.java如下:package cc.openhome;public class main public static void main(stringargs) system.out.println(hello world);文本模式下你的工作路径是c:workspacehello,那么如何编译与执行main类别? a、javac srcmain.java java c:workspacehelloclassesmain b、javac d classes srcmain.java java cp classes main c、

9、javac d classes srcmain.java java cp classes cc.openhome.main d、javac d classes srcmain.java java cp classesccopenhome main 9如果有个console类别的原始码开头定义如下:package cc.openhome; public class console .如何在另一个类别中撰写import? a、import cc.openhome.console; b、import cc.openhome; c、import cc.openhome.*; d、import cons

10、ole;10关于包以下何者正确? a、要使用java se api的system类别必须import java.lang.system; b、在程序中撰写import java.lang.system;会发生编译错误,因为java.lang中的类别不用import c、import并不影响执行效能 d、程序中撰写了import cc.openhome.main,执行java指令时只要下java main就可以了第三章1如果有以下的程序代码:int number;system.out.println(number);以下描述何者正确? a、执行时显示0 b、执行时显示随机数字 c、执行时出现错误

11、 d、编译失败2如果有以下的程序代码:system.out.println(10 / 3);以下描述何者正确? a、执行时显示3 b、执行时显示3.33333. c、执行时出现错误 d、编译失败3如果有以下的程序代码:float radius = 88.2;double area= 2 * 3.14 * radius * radius;system.out.println(area);以下描述何者正确? a、执行时显示48853.6272 b、执行时显示48853 c、执行时出现错误 d、编译失败正确答案: d4如果有以下的程序代码:byte a = 100;byte b = 200;byte

12、 c = (byte) (a + b);system.out.println(c);以下描述何者正确? a、执行时显示300 b、执行时显示127 c、执行时出现错误 d、编译失败5如果有以下的程序代码:system.out.println(integer.max_value + 1 = integer.min_value);以下描述何者正确? a、执行时显示true b、执行时显示false c、执行时出现错误 d、编译失败6如果有以下的程序代码:system.out.println(-integer.max_value = integer.min_value);以下描述何者正确? a、执行

13、时显示true b、执行时显示false c、执行时出现错误 d、编译失败7如果有以下的程序代码:int i = 10;10int number = i+;number = -i;以下描述何者正确? a、执行后number为10,i为10 b、执行后number为10,i为11 c、执行后number为11,i为10 d、执行后number为11,i为118如果有以下的程序代码:int i = 10;int number = +i;number = +i;以下描述何者正确? a、执行后number为11,i为11 b、执行后number为11,i为12 c、执行后number为12,i为11

14、d、执行后number为12,i为129如果有以下的程序代码:for(int i = 1; i 10; i+) if(i = 5) continue;system.out.printf(i = %d%n, i);以下描述何者正确? a、显示i =1到4,以及6到9 b、显示i =1到9 c、显示i =1到4 d、显示i = 6到910如果有以下的程序代码:for(int number = 0; number != 5; number = (int) (math.random() * 10) system.out.println(number);以下描述何者正确? a、执行时显示数字永不停止 b

15、、执行时显示数字0后停止 c、执行时显示数字5后停止 d、执行时显示数字直到number为5后停止第四章1如果有以下的程序代码:int x = 100;int y = 100;integer wx = x;integer wy = y;system.out.println(x = y);system.out.println(wx = wy);在jdk5以上的环境编译与执行,请问显示结果为何? a、true、true b、true、false c、false、true d、编译失败2如果有以下的程序代码:int x = 200;int y = 200;integer wx = x;integer

16、 wy = y;system.out.println(x = wx);system.out.println(y = wy);在jdk5以上的环境编译与执行,请问显示结果为何? a、true、true b、true、false c、false、true d、编译失败3如果有以下的程序代码:int x = 300;int y = 300;integer wx = x;integer wy = y;system.out.println(wx.equals(x);system.out.println(wy.equals(y);以下描述何者正确? a、true、true b、true、false c、f

17、alse、true d、编译失败4如果有以下的程序代码:int arr1 = 1, 2, 3;int arr2 = arr1;arr21 = 20;system.out.println(arr11);以下描述何者正确? a、执行时显示2 b、执行时显示20 c、执行时出现arrayindexoutofboundexception错误 d、编译失败5如果有以下的程序代码:int arr1 = 1, 2, 3;int arr2 = new intarr1.length;arr2 = arr1;for(int value : arr2) system.out.printf(%d, value);以下

18、描述何者正确? a、执行时显示123 b、执行时显示12300 c、执行时出现arrayindexoutofboundexception错误 d、编译失败6如果有以下的程序代码:string strs = new string5;以下描述何者正确? a、产生5个string实例 b、产生1个string实例 c、产生0个string实例 d、编译失败7如果有以下的程序代码:string strs = java, java, java, java, java;以下描述何者正确? a、产生5个string实例 b、产生1个string实例 c、产生0个string实例 d、编译失败8如果有以下的程

19、序代码:string strs = new string25;以下描述何者正确? a、产生10个string实例 b、产生2个string实例 c、产生0个string实例 d、编译失败9如果有以下的程序代码:string strs = java, java, java, java, java, java, java;system.out.println(strs.length);system.out.println(strs0.length);system.out.println(strs1.length);以下描述何者正确? a、显示2、3、4 b、显示2、0、1 c、显示1、2、3 d、

20、编译失败10如果有以下的程序代码:string strs = java, java, java, java, java, java, java;for(_row : strs) for(_str : row) . 空白处应该分别填上什么? a、string、string b、string、string c、string、string d、string、string第五章1 如果有以下程序片段:public class some private some some; private some() public static some create() if(some = null) some =

21、 new some(); return some; 以下描述何者正确? a、 编译失败 b、 客户端必须new some()产some生实例 c、 客户端必须new some().create()产生some实例 d、 客户端必须some.create()产生some实例 2 如果有以下程序片段:int scores1 = 88, 81, 74, 68, 78, 76, 77, 85, 95, 93;int scores2 = arrays.copyof(scores1, scores1.length); 其中arrays完全吻合名称为java.util.arrays,以下描述何者正确? a、

22、 arrays.copyof()应该改为new arrays().copyof() b、 copyof()是static成员 c、 copyof()是public成员 d、 arrays被宣告为public 3 如果有以下程序片段:public class some public int x; public some(int x) this.x = x; 以下描述何者正确? a、 建构some时,可使用new some()或new some(10)形式 b、 建构some时,只能使用new some()形式 c、 建构some时,只能使用newsome(10)形式 d、 没有无自变量建构式,所

23、以编译失败 4 如果有以下程序片段:public class some public int x; public some(int x) x = x; 以下描述何者正确? a、 new some(10)建构对象后,对象成员x值为10 b、 new some(10)建构对象后,对象成员x值为0 c、 some s = new some(10)后,可使用s.x取得值 d、 编译失败 5 如果有以下程序片段:public class some private int x; public some(int x) this.x = x; 以下描述何者正确? a、 new some(10) 建构物件后,成

24、员 x值为 10 b、 new some(10) 建构物件后,成员 x值为 0 c、 some s = new some(10) 后,可使用 s.x 取得值 d、 编译失败 6 如果有以下程序片段:package cc.openhome.util; class some public int x; public some(int x) this.x = x;以下描述何者正确? a、 cc.openhome.util 套件中其它程序代码可以 new some(10) b、 cc.openhome.util 套件外其它程序代码可以 new some(10) c、 可以在其它套件 import cc

25、.openhome.util.some; d、 编译失败 7 如果有以下程序片段:public class some private final int x; public some() public some(int x) this.x = x; 以下描述何者正确? a、 new some(10)建构对象后,对象成员x值为10 b、 new some(10)建构对象后,对象成员x值为0 c、 some s = new some(10)后,可使用s.x取得值 d、 编译失败 8 如果有以下程序片段:public class some public static int sum(int. num

26、bers) int sum = 0; for(int i = 10; i numbers.length; i+) sum += numbersi;20 return sum; 以下描述何者正确? a、 可使用some.sum(1, 2, 3)加总1、2、3 b、 可使用new some.sum(1, 2, 3)加总1、2、3 c、 可使用some.sum(new int1,2, 3)加总1、2、3 d、 编译失败,因为不定长度自变量只能用增强式for循环语法 9 如果有以下程序片段:public class some public static void somemethod(int i) s

27、ystem.out.println(int 版本被呼叫); public static void somemethod(integer integer) system.out.println(integer 版本被呼叫); 以下描述何者正确? a、 some.somemethod(1)显示int版本被呼叫 b、 some.somemethod(1)显示integer版本被呼叫 c、 some.somemethod(new integer(1)显示int版本被呼叫 d、 编译失败 10 如果有以下程序片段:public class main public intsome(int. numbers

28、) int sum = 0; for(int number : numbers) sum += number; return sum; public static void main(string args) system.out.println(sum(1, 2, 3); 以下描述何者正确? a、 显示6 b、 显示1 c、 无法执行 d、 编译失败 第六章1 如果有以下程序片段:class some void doservice() system.out.println(some service); class other extends some override void doserv

29、ice() system.out.println(other service); public class main public static void main(string args) other other = new other(); other.doservice(); 以下描述何者正确? a、 编译失败 b、 显示some service c、 显示other service d、 先显示some service、后显示other service 2 承上题,如果main()中改为:some some = new other();some.doservice();以下描述何者正确

30、? a、 编译失败 b、 显示some service c、 显示other service d、 先显示some service、后显示other service 3 如果有以下程序片段:class some string tostring() return some instance; public class main public static void main(string args) some some= new some(); system.out.println(some); 以下描述何者正确? a、 显示some instance b、 显示somexxxx,xxxx为16

31、进位数字 c、 发生classcastexception d、 编译失败 4 如果有以下程序片段:class some int hashcode() return 99; public class main public static void main(string args) some some = new some(); system.out.println(some.hashcode(); 以下描述何者正确? a、 显示99 b、 显示0 c、 发生classnotfoundexception d、 编译失败 5 如果有以下程序片段:class some override string

32、 tostring() return some instance; public class main public static void main(string args) some some = new some(); system.out.println(some); 以下描述何者正确? a、 显示some instance b、 显示somexxxx,xxxx为16进位数字 c、 发生classcastexception d、 编译失败 6 如果有以下程序片段:class some abstract void doservice();class other extends some

33、override void doservice() system.out.println(other service); public class main public static void main(string args) some some = new other(); some.doservice(); 以下描述何者正确? a、 编译失败 b、 显示other service c、 执行时发生classcastexception d、 移除override可编译成功 7 如果有以下程序片段:class some protected int x; some(int x) this.x

34、 = x; class other extends some other(int x) this.x = x; 以下描述何者正确? a、 new other(10)后,物件成员x值为10 b、 new other(10)后,物件成员x值为任意值 c、 other中无法存取x的编译失败 d、 other中无法呼叫父类别建构式的编译失败 8 如果有以下程序片段:public class iterablestring extends string public iterablestring(string original) super(original); public void iterate()

35、 /. 以下描述何者正确? a、 string s = new iterablestring(j)可通过编译 b、 iterablestring s = new iterablestring(j)可通过编译 c、 因无法呼叫super()的编译失败 d、 因无法继承string的编译失败 9 如果有以下程序片段:class some some() system.out.println(some(); this(10); some(int x) system.out.println(some(int x); class other extends some other() super(10);

36、system.out.println(other(); other(int y) system.out.println(other(int y); 以下描述何者正确? a、 new other()显示some(int x)、other() b、 new other(10)显示other(int y) c、 newsome()显示some(int x)、some() d、 编译失败 10 如果有以下程序片段:class some some() this(10); system.out.println(some(); some(int x) system.out.println(some(int

37、x); class other extends some other() super(10); system.out.println(other(); other(int y) system.out.println(other(int y); 以下描述何者正确? a、 new other()显示some(int x)、other() b、 new other(10)显示some()、some(int x)、other(int y) c、 new some()显示some(int x)、some() d、 编译失败 第七章 1 如果有以下程序片段:interface some protected

38、 void dosome();class someimpl implements some public void dosome() system.out.println(作一些事); public class main public static void main(string args) some s = new someimpl(); s.dosome(); 以下描述何者正确? a、 编译失败 b、 显示作一些事 c、 发生classcastexception d、 执行时不显示任何讯息 2 如果有以下程序片段:interface some int x = 10;public clas

39、s main public static void main(string args) system.out.println(some.x); 以下描述何者正确? a、 编译失败 b、 显示10 c、 必须建构some实例才能存取x d、 显示0 3 如果有以下程序片段:interface some void dosome();class someimpl implements some void dosome() system.out.println(作一些事); public class main public static void main(string args) some s =

40、new someimpl(); s.dosome(); 以下描述何者正确? a、 编译失败 b、 显示作一些事 c、 发生classcastexception d、 执行时不显示任何讯息 4 如果有以下程序片段:interface some void dosome();class someimpl implements some public void dosome() system.out.println(作一些事); public class main public static void main(string args) some s = new someimpl(); s.dosom

41、e(); 以下描述何者正确? a、 编译失败 b、 显示作一些事 c、 发生classcastexception d、 执行时不显示任何讯息 5 如果有以下程序片段:interface some void dosome();interface other void doother();class someotherimpl implements some, other public void dosome() system.out.println(作一些事);public void doother() system.out.println(作其它事);public class main pub

42、lic static void main(string args) some s = new someotherimpl(); s.dosome();other o = (other) s; o.doother(); 以下描述何者正确? a、 编译失败 b、 显示作一些事、作其它事 c、 发生classcastexception d、 执行时不显示任何讯息 6 如果有以下程序片段:interface some void dosome();abstract class abstractsome implements some public abstract void dosome(); publ

43、ic void doservice() system.out.println(作一些服务); public class main public static void main(string args) abstractsome s = new abstractsome(); s.doservice(); 以下描述何者正确? a、 编译失败 b、 显示作一些服务 c、 发生classcastexception d、 执行时不显示任何讯息 正确答案: a7 如果有以下程序片段:interface some void dosome();abstract class abstractsome imp

44、lements some public abstract void dosome(); public void doservice() system.out.println(作一些服务); public class main public static void main(string args) abstractsome s = new abstractsome() public void dosome() system.out.println(作一些事); public void doservice() ; s.doservice(); 以下描述何者正确? a、 编译失败 b、 显示作一些

45、服务 c、 发生classcastexception d、 执行时不显示任何讯息 8 如果有以下程序片段:interface some void dosome();public class main public static void main(string args) some s = new some() public void dosome() system.out.println(作一些事); public void doservice() system.out.println(作一些服务); ; s.doservice(); 以下描述何者正确? a、 编译失败 b、 显示作一些服务 c、 发生classcastexception d、 执行时不显示任何讯息 9 如果有以下程序片段:interface some protected static final int x = 10;public class main public static void main(string args) system.out.println(some.x);以下描述何者正确? a、 编译失败 b、 显示10 c、

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论