设为首页 加入收藏

TOP

2019年3月计算机二级考试Java强化练习题及答案019
2019-03-18 10:08:40 】 浏览:453
Tags:2019年 3月 计算机 二级 考试 Java 强化 习题 答案 019

1.在一个线程中调用下列方法,不会改变该线程运行状态的是( )。


A.yield方法


B.另一个线程的join方法


C.sleep方法


D.一个对象的notify方法


答案: B


2.在关闭浏览器时调用,能够彻底终止Applet并释放该Applet所有资源的方法是( )。


A.stop()


B.destroy()


C.paint()


D.start()


答案:B


3.为了将HelloApplet(主类名为HelloApplet.class)嵌入在greeting.html文件中,应该在下列greeting.html文件的横线处填人的代码是( )。











A.(elloApplet.class


B.CODE="(elloApplet.class"


C.CODE="(elloApplet.class"WIDTH=150


HElGHT=25


D.CoDE="(elloApplet.class”" VSPACE=10


HSPACE=10


答案:C


4.下列变量名的定义中,符合Java命名约定的是( )。


A.fieldname


B.super


C.Intnum


D.$number


答案:A


5.自定义异常类的父类可以是( )。


A.Error


B.VirtuaMachineError


C.Exception


D.Thread


答案:C


6.阅读下列程序片段。


Public void test(){


Try{


sayHello();


system.out.println("hello"):


}catch(ArraylndexOutOfBoundException e){


System.out.println("ArraylndexOutOfBoundExcep―


tion");


}catch(Exception e){


System.out.println("Exception"):


}finally{


System.Out.println("finally");


}


}


如果sayHello()方法正常运行,则test()方法的运行结果将是( )。


A.Hello


B.ArraylndexOutOfBondsException


C.Exception


Finally


D.Hello


Finally


答案:D


7.为使Java程序独立于平台,Java虚拟机把字节码与各个操作系统及硬件( )。


A.分开


B.结合


C.联系


D.融合


答案:A


8.Java中的基本数据类型int在不同的操作系统平台的字长是( )。


A.不同的


B.32位


C.64位


D.16位


答案:B


9.String、StingBuffer都是( )类,都不能被继承。


A.static


B.abstract


C.final


D.Private


答案:C


10.下列程序的功能是统计字符串中“array”的个数,在程序的空白处应填入的正确选项是( )。


public class FindKeyWords(


public static void main(sring[]args){


sting text=


"An array is a data structur that stores a eollection of"


+"values of the same type.You access each individu-


al value"


+"through an integer index.For example.if a is an


array"


+"of inergers,then all]is the ith integer in the ar-


ray.";


Int arrayCount=0;


Int idex=-l;


Sting arrarStr="array":


Index=text.indexof(arrayStr);


While(index 0){


++arrayCount:


Index+=arrayStr.1ength();


Index=text.indexof(arrayStr,index);


}


System.OUt.println


("the text contains"+arrayCount+"arrays");


}


}


A.<


B.=


C.<=


D.>=


答案:D


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇2019年3月计算机二级考试Java强化.. 下一篇2019年3月计算机二级考试Java强化..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目