更多"[单选题]在程序的下划线处应填入的选项是:
public clas"的相关试题:
[单选题]在程序的下划线处应填入的选项是:
public class Test_____{
public static void main(String args[]){
Test t = new Test();
Thread tt = new Thread(t);
tt.start();
}
public void run(){
for(int i=0;i<5;i++){
System.out.println("i="+i);
}
}
}
A.implements Runnable
B.extends Thread
C.implements Thread
D.extends Runnable
[单选题]下列程序的功能是将一个整数数组写入二进制文件。在程序的下划线处应填入的选项是:
import java.io.*;
public class XieShuzu{
public static void main(String[] a){
int [] myArray={10,20,30,40};
try{
DataOutputStream dos=
new DataOutputStream(new FileOutputStream("ints.dat"));
for(int i=0;i
dos. _____(myArray[i]);
dos.close();
System.out.println("已经将整数数组写入二进制文件:ints.dat");
}catch(IOException ioe)
{System.out.println("IO Exception");}
}
}
A.writeArray
B.writeByte
C.writeInt
D.writeDouble
[单选题]在下列代码的下划线处应填入的内容是:
public class FirstSample {
public static void main(_____ args[]) {
System.out.println("你好!");
}
}
}
A.staff
B.double
C.int
D.String
[单选题]下列代码的下划线处应填入的方法名是:
import java.applet.*;
import java.awt.*;
public class Hello extends Applet {
public void _____(Graphics g){
g.drawString("How are you!", 10, 10);
}
}
A.repaint
B.println
C.paint
D.show
[单选题]要得到某目录下的所有文件名,在下列代码的下划线处应填入的内容是(两个下划线的内容相同):
_____ pathname = new _____(args[0]);
String[] filename = pathname.list();
A.FileInputStream
B.FileOutputStream
C.File
D.RandomAccessFile
[单选题]下列程序的功能是统计字符串中"array"的个数,在程序的空白处应填入的正确选项是:
public class FindKeyWords{
public static void main(sring[] 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 inergers, then a[i] is the ith integer in the array.";
int arrayCount =0;
int idex = -1;
String arrarStr ="array";
index = text.indexof(arrayStr);
while(index ______ 0) {
++arrayCount;
index += arrayStr.length();
index = text.indexof(arrayStr,index);
}
System.out.println
("the text contains" + arrayCount + "arrays");
}
}
A.<
B.=
C.<=
D.>=