start()
close()
read()
write()
第1题:
能将程序补充完整的选项是______。 class Person{ private int a; phblic int change(int m){return m;} } public class Teacher extends Person{ public int b; public static void main(String arg[ ]){ Person p=new Person( ); Teacher t=new Teacher( ); int i; ______; } }
A.i=m
B.i=b
C.i=p.a
D.i=p.change(50)
第2题:
( 20 )在下列程序的空白处,应填入的正确选项是
import java.io.*;
Public class writeInt{
Public static void main(string[ ] a) {
Int[ ] myArray = {10,20,30,40};
try{
DataOutputSystem dos= new DataOutputSystem
( new FileOutputSystem( “ ints.dat ” ) ) ;
for ( int i=0 ; I<myArray.length ; i++ )
dos 。 writeInt ( myArray[i] ) ;
dos.
System.out.println
( “ Have written binary file ints.dat ” );
}
Catch(IOException ioe)
{ System.out.println( “ IO Exception ” );
}
}
}
A)start( )
B)close( )
C)read( )
D)write( )
第3题:
下列程序段的输出结果是【 】。
public class Test {
void printValue(int m) {
do {
System.out.println("The value is"+m);
}while (--m>10);
}
public static void main (String args[]) {
int i=10;
Test t= new Test();
t.printValue(i);
}
}
第4题:
阅读下面程序 import java.io.*; public class ByteStreamTest { public static void main(String[] A) { int [] myArray = {10,20,30,40 }; try{ DataOutputStream dos = new DataOutputStream ( new______ ("ints.dat")); for (int i=0; i<myArray, length; i++) dos.writelnt( myArray[i] ); dos.close(); System.out.println("Have written binary file ints.dat"); } catch (IOException ioe){ Sy stem.out.println("IO Exception"); } } } 为保证程序正确运行,在程序中下划线处应填入的代码是
A.FileOutputStream
B.ByteArrayOutputStream
C.BufferedOutputStream
D.FileWriter
第5题:
下列代码的执行结果是public class Test{ public int aMethod(){ static int i=0; i++; System.out.println(i); } public static void main(String args[]){ Test test= new Test(); test. aMethod(); }}
A.编译错误
B.0
C.1
D.运行成功,但不输出
第6题:
阅读下面程序
import java.io.*;
public class ByteStream Test{
public static void main(String[] a){
int[] myArray = {10,20.30,40};
try{
DataOutputStream dos = new DataOutputStream
(new _________________( " ints.dat " ));
for (int i=0;i<myArray.length;i++)
dos.writeInt(myArray[i] ) ;
dos.close();
S ystem.out.println( " Have written binary file ints.dat " );
}
catch (IOException ioc){
System.out.println( " IO Exception " );
}
}
}
为保证程序正确运行,在程序中下划线处应填入的代码是
A)FileOutputStream
B)ByteArrayOutputStream
C)BufferedOutputStream
D)FileWriter
第7题:
下列程序的执行结果是 ( ) public class Test { public int aMethod() { satic int i=0; i++; System.out.println(i); } public static void.main(String args[]) { Test test=new Test(); test.aMethod(); }
A.编译错误
B.0
C.1
D.运行成功,但不输出
第8题:
能将程序补充完整的选项是( )。class Person{ private int a; public int change(int m){ return m; }}public class Teacher extends Person{ public int b; public static void main(String arg[]) { Person p = new Person(); Teacher t = new Teacher(); int i; ______ }} B.
A.i=m
B.i=b
C. i=p.a
D.i=p. change(50)
第9题:
在下列程序的划线处应填入的语句是class Person { private int a;}public class Man extends Person{ public int b; public static void main (String arg []){ Person p=new Person(); Man t=new Man(); int i: }}
A.i=w;
B.i=b
C.i=p.a;
D.i=t.b;
第10题:
阅读下面写文件的程序 import java. io. *; public class WriteFile{ public static void main(String[]A) { int[]myArray={10,20,30,40}; try{ FileOutputStream f=new FlieOutStream("ints. dat"); DataOutputStream______=new DataOutputStream(f); for(int i=0; i<myArray. length; i ++) dos. writeInt(myArray[i]); dos. close(); System. out. prinfln("Have written binary file ints. dat"); } catch(IOException ioe){ System. out. println("IO Exception"); } } 在程序下画线处填入的正确选项是
A.myArray
B.dos
C.ioe
D.ints