在下列程序的空白处,应填入的正确选项是( )。 importjava.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;lMYARRAY.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.startB.closeC.readD.write

在下列程序的空白处,应填入的正确选项是( )。 importjava.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;l<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


相关考题:

下列程序中画线处应填入的语句是class Base{public:void fun(){cout ”Base of fun”};class Derived:public Base{void fun(){//显示基类的成员函数funcout ”Derived of fun”};A.fun();B.Base. fun();C.Base::fun();D.Base- fun-:

阅读下面程序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;imyArray.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)FileOutputStreamB)ByteArrayOutputStreamC)BufferedOutputStreamD)FileWriter

( 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 ; ImyArray.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( )

( 30 )下列程序的功能是统计字符串中 “ array ” 的个数,在程序的空白处应填入的正确选项是public class FindKey Word s{public static void main(sring[] args){sting 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;Sting 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) =

下列是定义一个接口ITF的程序,在横线处应填入的选项是 ( )public interface ITF{public static final double PI=3.14,public ______ double area(double a,double b);}A.interfaeeB.staticC.finalD.abstract

下列程序中横线处正确的语句是()。includeusing namespace std;class TestClass{publi 下列程序中横线处正确的语句是( )。 #include<iostream> using namespace std; class TestClass { public: void fun(){cout<<"TestClass::fun"<<end1;} }; class TestClass1:public TestClass { void fun() { ______//显示调用基类的函数 fun() cout<<"TestClass1::fun"<<end1; } };A.fun();B.TestClass.fun()C.TestClass::fun();D.TestClass->fun();

在下列程序画线处填入的正确语句是()。includeusing namespace std;classBase{public: 在下列程序画线处填入的正确语句是( )。 #include <iostream> using namespace std; class Base { public: void fun() { cout<<"Base::fun",<<end1; } }; class Derived:public Base { void fun() { ______________ //显式调A.fun();B.Base.fun();C.Base::fun();D.Base->fun();

阅读下面写文件的程序 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.myArrayB.dosC.ioeD.ints

阅读下面程序 public class Test2______ { public static void main(String[] args){ Thread t=new Test2(); t. start(); } public void run(){ System. out. priatln("How are you. "); } } 在程序下画线处填入的正确的选项是A.implements ThreadB.extends RunnableC.implements RunnableD.extends Thread

阅读下面程序 public class Test implements Runnable{ public static void main(String[]args){ _______________________________________; t. start(); } public void mR(){ System. out. println("Hello!"); }} 在程序下画线处填入正确选项是A.Test t=flew Test()B.Thread t=new Thread();C.Thread t=new Thread(new Test());D.Test t=new Thread();

阅读下面实现堆栈类并发控制的部分代码 public class DataStack{ private int idx=0; private int[]data=new int[8]; public void push(int i){ . ________________{ data[idx]=i; idx + +; } } } …… } 在程序下画线处填入正确选项是A.synchronizedB.synchronized(this)C.synchronized()D.synchronized(idx)

在下列程序的空白处,应填入的正确选项是( )。A.start( )B.close( )C.read( )D.write( )

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

下列程序创建了一个线程并运行,横线处应填入的正确代码是( )。 public class Try extends Thread{ public static void main(String args[]){ Thread t=new Try; ; } public void runf System.out.println(”Try!"); } }A.t.startB.t.classC.t.threadD.t.static

在下列程序的空白处,应填入的正确选项是( )。 importjava.io.*; PublicclasswriteInt{ Publicstaticvoidmain(stringl)a){ Int[]myArray={10,20,30,40}; try{ DataOutputSystemdos=newDataOutputSystem (newFileOu中utSystem(“ints.dat”)); for (int i=0;I<MYARRAY.LENGTH:I++) dos.writeInt(myArray[i]; dos.______"; System.out.println (“Havewritten binary flleints.dat”); } Catch(IOExceptiOniOe) {System.out.println(“IOException”); } } }A.start()B.Close()C.read()D.write()

在下列程序的空白处,应填入的正确选项是( )。A.WriterObjectB.WriterC.BufferedWriterD.writerObject

下列哪个选项的java源文件程序段是不正确的? ( )A.package testpackage; public class Test{ }B.import java.io.*; package testpackage; public class Test{ }C.import java.i.*; class Person{} public class Test{ }D.import java.io.*; import java.awt.*; public class Test { }

下列程序实现对ZIP文件file.zip的检索,在横线处 填入正确的语句( )。 package test; importjava.io.*; import java.util.*; import java.util.zip.*; public class Exam { public static void main(String[]args){ try{ FileInputStream fis=new FileInputStream("test/file. zip"); ZipInputStream zis=new ZiplnputStream(fis); ZipEntry an; while(( )!=null){ en.getName; zis.closeEntry; } zis.close: } catch(Exception e){ printStackTrace; } } }A.en=zis.getNextEntryB.en= =zis.getNextEntryC.en=zis.getEntryD.zis.getNextEntry

阅读下面写文件的程序 import java.io.*: public class WriteFile{ public static void main(String[] A) { int[] myArray={10,20,30,40}; try { FileOutputStream f=new FileOutputStream("ints.dat"); DataOutputStream ______ =new DataOutputStream(f); for(int i=0;i<myArray.length;i++)dos.writeInt(myArray[i]); dos.close(); System.out.println("Have written binary file ints.dat"); } catch(IOException ioe) { System.out.println("IOException"); } } } 程序中下画线处应填入的正确选项是A.myArrayB.dosC.ioeD.ints

阅读下面程序 public class Test2 ______ { public static void main(String[] args) { Thread t=new Test2(); t.start(); } public void run() { System.out.println("How are you."); } } 程序中下画线处应填入的正确选项是A.implements ThreadB.extends RunnableC.implements RunnableD.extends Thread

阅读下面程序 public class Test implements Runnable { public static void main(String[] args) { ______ t.start(); } public void run() { System.out.println("Hello!"); } } 程序中下画线处应填入的正确选项是A.Test t=new Test();B.Thread t=new Thread();C.Thread t=new Thread(new Test());D.Test t=new Thread();

阅读下面实现堆栈类并发控制的部分代码 public class DataStack } private int idx=0; private int[] data=new int[8]; public void push(int i) { ______ { data[idx]=I: idx++; } } … } 程序中下画线处应填入的正确选项是A.synchronizedB.synchronized(this)C.synchronized()D.synchronized(idx)

下列程序片段中,能通过编译的是( )。 A.public abstract class Animal{ public void speak;}S 下列程序片段中,能通过编译的是( )。A.public abstract class Animal{ public void speak;}B.public abstract class Animal{ public void speak{);}C.public class Animal{ pubilc abstract void speak;}D.public abstract class Animal{ pubile abstract void speak{};}

下列的程序的功能是求2~100之间的素数,程序中划线部分应填入的选项是 public class Testnn { public static void main(String args[]) { Labell: for(int i=2;i100;i++) { for(int j=2;j<i;j++) { if(i%j==______)continue Labell; } System.out.println(i); } } }A.0B.1C.iD.j

( 30 )在程序的下划线处应填入的选项是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;i5;i++){system.out.println( " i= " +i);}}}A ) implements RunnableB ) extends ThreadC ) implements ThreadD ) extends Runnable

在C#程序中,如果类B要继承类A,类B正确的定义为()。A、public class B inherit AB、public class B :: AC、public class B : AD、public class B from A

单选题在下列程序的空白处,应填入的正确选项是(  )。import java.io.*;public class ObjectStreamTest{public static void main(string args[])throws IOException{ ObjectOutputStream oos=new ObjectOutputStream(new FileOutputStream("serial.bin")); Java.until.Date d=new Java.until.Date(); oos.______(); ObjectInputStream ois=new ObjectlnputStream(new FileOutputStream("serial.bin")); try{ java.until.date restoredDate=(Java.until.Date)ois.readObject(); System.out.println("read object back from serial.bin file:"+restoredDate); } catch(ClassNotFoundException cnf){ System.out.println("class not found"); }}AreadObjectBWriterCBufferedWriterDwriteObject