全部知识点
在一个线程中调用下列方法,不会改变该线程运行状态的是( )。
在关闭浏览器时调用,能够彻底终止Applet并释放该Applet所有资源的方法是( )。
了将HelloApplet(主类名为HelloApplet.class)嵌入在greeting.html文件中,应该在下列greeting.html文件的横线处填入的代码是( )。
<HTML> <HEAD> <TITLE>Greetings</TITLE> </HEAD> <BODY> <APPLET ______> </APPLET> </BODY> </HTML>
下列变量名的定义中,符合Java命名约定的是( )。
自定义异常类的父类可以是( )。
阅读下列程序片段:
public void test(){
try{
sayHello();
System.out.println("hello");
}catch(ArrayIndexOutOfBoundsException e){
System.out.println("ArrayIndexOutOfBoundsException");
}catch(Exception e){
System.out.println("Exception");
}finally{
System.out.println("finally");
}
}如果sayHello()方法正常运行,则test()方法的运行结果将是( )。
为使Java程序独立于平台,Java虚拟机把字节码和各个操作系统及硬件( )。
Java中的基本数据类型int在不同的操作系统平台的字长是( )。
String、StringBuffer都是( )类,都不能被继承。
下列程序的功能是统计字符串中“array”的个数,在程序的空白处应填入的正确选项是( )。
public class FindKeyWords
{
public static void main(String[] args)
{
String text = "An array is a data structur that stores a collection of"
+"values of the same type. You access each individual value"
+"through an integer index. For example,if a is an array"
+"of inegers,then a[i] is the ith integer in the array.";
int arrayCount=0;
int index=-1;
String arrayStr="array";
index=text.indexOf(arrayCount);
while(index ______ 0)
{
++arrayCount;
index+=arrayStr.length();
index=text.indexOf(arrayStr,index);
}
System.out.println("the text contains"+arrayCount+"arrays");
}
}构造方法名必须与( )相同,它没有返回值,用户不能直接调用它,只能通过new调用。
在多线程并发程序设计中,能够给对象X加锁的语句是( )。
Java中类ObjectOutputStream支持对象的写操作,这是一种字节流,它的直接父类是( )。
在下列程序的空白处,应填入的正确选项是( )。
import java.io.*;
public class ObjectStreamTest{
public static void main(String[] args)throws IOException{
ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream("serial.bin"));
java.util.Date d=new java.util.Date();
oos.______;
ObjectInputStream ois=new ObjectInputStream(new FileOutputStream("serial.bin"));
try{
java.util.Date restoredDate=(java.util.Date)ois.readObject();
System.out.println("read object back from serial.bin file:"+restoredDate);
}catch(ClassNotFoundException cnfe){
System.out.println("class not found");
}
}
}Class类的对象由( )自动生成,隐藏在.class文件中,它在运行时为用户提供信息。
在Java中,实现用户界面功能的包是( )。
“++”运算符的操作数个数是( )。
在switch(expression)语句中,expression的数据类型不能是( )。
下列叙述中,错误的是( )。
已知:int a[]=new int[100];在下列给出的数组元素中,非法的是( )。