JAVA开发工程师考试题.docVIP

  • 19
  • 0
  • 约1.41万字
  • 约 10页
  • 2019-12-01 发布于河北
  • 举报
全国1+N复合型人才培养工程 JAVA开发工程师 考试试题 第 PAGE 9页 共 NUMPAGES 10页 考生答题不得超过此密封线考试地点: 考生姓名: 考生答题不得超过此密封线 考试地点: 考生姓名: 考生性别: 考生年龄: 证件类型: 证件号码: 装 订 线 线 订 装 总 分 题 号 一 二 三 核分人 得 分 得 得 分 评分人 选择题(本大题共40小题,每小题1分,共40分) 在每小题列出的备选项中只有一个是符合题目要求的,请将其代码填写在题后的括号内。错选、多选或未选均无分。 int index=1; int foo[]=new int[3]; int bar=foo[index]; int baz=bar+index; 经过以上代码后,baz的值是多少?( b ) baz 值为 0 baz 值为1 baz 值为2 程序运行时抛出异常 代码不能编译 Public class Test{ Public static void add3(Integer i){ int val=value(); val+=3; i=new Integer(val); } Public static void main(String args[]){ Integer i=new Integer(0); add3(i); System.out.println(value()); } } 以上代码执行结果是什么?( b ) 编译错误 打印0 打印3 编译成功但运行时有第3行出现异常 class EnclosingOne{ public class InsideOne{} } Public class InnerTest{ Public static void main(String args[]){ EnclosingOne eo=new EnclosingOne(); //在这插入代码 } } 应将哪行代码插入代码块中?( e ) InsideOne ei=eo.new InsideOne(); eo.InsideOne ei=eo.new InsideOne(); InsideOne ei=EnclosingOne.new InsideOne(); InsideOne ei=eo.new InsideOne(); EnclosingOne.InsideOne ei=eo.new InsideOne(); 下面哪个是is a的关系?(b ) Public interface Color{} public class Shape{private Color color;} interface Component{} class Container implements Component{ private Component[] children; } public class Species{} publiclass Animal{private Species species;} public class SychTest{ private int x; private int y; public voisetX(int i){ x=i;} public voisetY(int i){y=i;} public synchronize void setXY(int i){ setX(i); setY(i); } Public synchronizeboolean check(){ return x!=y; } } 在什么条件下,在其它类中调用check()返回true? ( c ) check() 永远不返回 true 当setXY 被多个线程调用时check() 返回true 当多个线程分别调用setX和setY时check() 返回true 只有SychTest被改写为x和y可

文档评论(0)

1亿VIP精品文档

相关文档