资源描述:
《月考javaSE部分》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、一、单选(35小题共70.0分)1.下列代码的输出结果是:publicclassYikes{publicstaticvoidgo(Longn){System.out.println("Long");}publicstaticvoidgo(Shortn){System.out.println("Short");}publicstaticvoidgo(intn){System.out.println("int");}publicstaticvoidmain(String[]args){shorty=6;longz=7;go(y);
2、go(z);}}A.LongLongB.ShortLongC.intLongD.intint2.下面不属于Java语言特点的是:A.平台无关B.面向对象C.支持指针类型D.垃圾回收机制3.下面关于final说法错误的是:()A.final修饰类时,该类不能被继承。B.final修饰方法时,该方法不能被重写。C.当引用到使用staticfinal修饰的常量时,将采用编译期绑定的方式。D.当使用final和abstract共同修饰一个类时,final应至于abstract之前。4.下列代码的输出结果是()。publicstatic
3、voidmain(String[]args){int[]one=newint[]{4,6,8};int[]two=newint[]{1,3,5,7,9};System.arraycopy(one,1,two,2,2);System.out.println(Arrays.toString(two));}A.[1,3,7,4,6]B.[1,3,5,7,8]C.[1,3,5,6,9]D.[1,3,6,8,9]5.下列代码的输出结果是()。publicstaticvoidmain(String[]args){Runnabler=new
4、Runnable(){publicvoidrun(){System.out.print("Cat");}};Threadt=newThread(r){publicvoidrun(){System.out.print("Dog");}};t.start();}A.CatB.DogC.没有任何输出D.抛出运行时异常6.运行下面的程序:Calendarc=Calendar.getInstance();c.set(Calendar.YEAR,2012);c.set(Calendar.MONTH,Calendar.SEPTEMBER);
5、c.set(Calendar.DATE,31);SimpleDateFormatsdf=newSimpleDateFormat("yyyy-MM-dd");System.out.println(sdf.format(c.getTime()));输出的结果是:()。A.2012-10-1B.2012-10-01C.2012-09-30D.2012-9-307.下列代码中对象锁的使用效率最高的是:A.publicclassFoo{privateObjecto1,o2;publicsynchronizedvoidmethodA(){
6、对o1进行操作}publicsynchronizedvoidmethodB(){对o1进行操作}publicsynchronizedvoidmethodC(){对o2进行操作}publicsynchronizedvoidmethodD(){对o2进行操作}}B.publicclassFoo{privateObjectlock=newObject();privateObjecto1,o2;publicvoidmethodA(){synchronized(lock){对o1进行操作}}publicvoidmethodB(){syn
7、chronized(lock){对o1进行操作}}publicvoidmethodC(){synchronized(lock){对o2进行操作}}publicvoidmethodD(){synchronized(lock){对o2进行操作}}}C.publicclassFoo{privateObjectlock=newObject(),lock2=newObject();privateObjecto1,o2;publicvoidmethodA(){synchronized(lock){对o1进行操作}}publicvoidme
8、thodB(){synchronized(lock){对o1进行操作}}publicvoidmethodC(){synchronized(lock2){对o2进行操作}}publicvoidmethodD(){synchronized(lock2){对o2进行操作}}}D.p