(字节数组字节流)下列代码将对象写入的设备是________。ByteArrayOutputStream bout=new ByteArrayOutputStream(); ObjectOutputStream out=new ObjectOutputStream(bout); out.writeObject(this); out.close();A.内存B.硬盘C.屏幕D.网络
(字节数组字节流)下列代码将对象写入的设备是________。ByteArrayOutputStream bout=new ByteArrayOutputStream(); ObjectOutputStream out=new ObjectOutputStream(bout); out.writeObject(this); out.close();
A.内存
B.硬盘
C.屏幕
D.网络
参考答案和解析
ByteArrayOutputStream
相关考题:
下列代码将对象写入的设备是ByteArrayOutputStreambout=new ByteArrayOutputStream();ObjectOutputStream ut=new ObjectoutputStream(bout);out.writeObject(this);out .close();A.内存B.硬盘C.屏幕D.网络
阅读下列代码段 ByteArrayOutputStream bout=new ByteArrayOutputStream(); ObjectOutputStream ut=new ObjectOutputStream(bout); out. writeObject(this); out. close(); 以上代码段的作用是A.将对象写入内存B.将对象写入硬盘C.将对象写入光盘D.将对象写入文件
阅读下列 Java 语句ObjectOutputStream outNew ObjectOutputStream {new_______( “ employee.dat ” )};在下划线处,应填的正确选项是A ) FileB ) FileWriterC ) FileOutputStreamD ) OutputStream
阅读下面Java语句 ObjectOutputStream ut=new ObjectOutputStream(new______("employee.dat"));在下画线处,应填的正确选项是A.FileB.FileWriterC.FileOutputStreamD.OutputStream
下列程序将类C15的对象写入文件filetxt,选择正确的语句填入下列程序的横线处。 package ch2; import java.util.*; import java.io.*; class C15______ { public iht a; public void setInt(int newa) { a = newa; } } public class Testl5 { pulibc static void main(String[] args) { C15 bj = new C15(); try { FileOutputStream fos =newFileOutputStream("ch2\\filel5.txt"); ObjectOutputStream os = ObjectOutputStream(fos); Obj.setInt(10); oos.writeObject(obj); oos.close (); fos.close(); } catch(IOException ioe) { ioe.printStackTrace(); } } }A.implements RunnableB.implements SedalizableC.extends SerializableD.implements InputStream
选择正确的语句填在下列程序的横线处,使程序正常运行。 package ch1; import java. io. *; import j ava. util. *; class C45 implements Seritizable ______Public Thread t = new Thread(new T45(), "t"); public intcnt = 0; public C45() { t. start ( ) class T45 implements Runnable public int[] a = new int[4]; public void run() { for(int i - 0; i < 4; i++) { a[i] - i +4; } } } public class ex45 { static String fileName = "ch1\\file45.txt"; public static void main(String[] args) throws Exception { C45 bj = new C45 (); FileOutputStream fos = new FileOutputStream(fileName); ObjectOutputStream os = new ObjectOutputStream(fos); oos. writeObject (obj); oos.clese (); fos.close (); System. out, println (obj . toString ( ) ); } }A.transientB.protectedC.packageD.final
Java中类ObjectOutputStream支持对象的写操作,这是一种字节流,它的直接父类是( )。A.WriterB.DataOutputC.OutputStreamD.OtpectOutput
在下列程序的空白处,应填入的正确选项是( )。 Importjava.io.*; PulilcclassObjectStreamTest{ Publilcstaticvoidmain(string args [])thowsIOException{ ObjectOutputStream os=new ObjectOutputStream (newFileOutputStream(“serial.bln”)); Java.util.Dated=newJava.util.Date(); Oos______(d); ObjectlnputStreamois= newObjectlnputStream(newFileOutputStream(“serial.bin”)); try{ iava.util.daterestoredDate= (Java.util.Date)ois.readObject(); System.out.println (“readobjectbackfromserial.binfile:” +restoredDate); } Catch(ClassNotFoundException cnf){ System.out.println(“classnotfound”); } }A.WriterObjectB.WriterC.BufferedWriterD.writerObject
阅读下列Java语句: ObjectOutputStream Ut=new ObjectOutputStream(new (employee.datemployee.dat));在下画线处,应填的正确选项是( )。A.FileB.FileWriterC.FileOutputStreamD.Outputstream
下列程序的功能是将一个整数数组写入二进制文件,在程序的下画线处应填入的选项是( )。 importjava.io.*; public class XieShuzu{ Dublic static void main(String[]a){ Int[]myArray=(10,20,30,40); try{ DataOutputStream dos= new DataOutputStream(new FileOutput Stream("ints.dat")); for(int i=0:imyArray.length;i++) dos. (myArray[i]); dos.close; System.out.println("已经将整数数组写入二进制文件:ints.dat"); }catch(IOException ioe) {System.out.println("IO Excepr_on");} } }A.writeArrayB.writeByteC.writeIntD.writeDouble
下列代码将对象写入的设备是( )。 ByteArrayOutputStream bout=new ByteArrayOut- putStream; ObjectOutputStream ut=new ObjectOutputStream (bout); out.writeObject(this); out.close;A.内存B.硬盘C.屏幕D.网络
阅读下列Java语句: ObjectOutputStream Ut=new ObjectOutputStream(new ("employee.dat")); 在下画线处,应填的正确选项是( )。A.FileB.FileWriterC.FileOutputStreamD.Outputstream
下列程序将Date对象写入文件file42.txt中,选择正确的语句填入下列程序中的横线处。 package ch1; impbrt java. io. *; import java. util. *; public class ex42 { static String fileName = "ch1\\file42.txt"; static Date date = null; public static void main(String[] args) { date = new Date(); try { FileOutputStream fos = new FileOutputStream(file Name); ObjectOutStream os = new ObjectOutputStream(fos); oos.______; oos.close(); fos.close(); System.out.println(date.toString()); } catch(Exception e) { System.out.println(e.getMessage()); } } }A.writeObject()B.writeObject(date)C.write(date)D.writeByte(date)
下列选项中,关于ByteArrayOutputStream类的描述正确的是?() A.ByteArrayOutputStream流中缓冲区的大小不能被定义B.ByteArrayOutputStream流关闭后仍可被调用,并且不会产生任何IOExceptionC.ByteArrayOutputStream流关闭后不能被使用,否则抛出IOExceptionD.ByteArrayOutputStream流必须与ByteArrayInputStream流配对使用
import java.io.*; public class Forest implements Serializable { private Tree tree = new Tree(); public static void main(String [] args) { Forest f= new Forest(); try { FileOutputStream fs = new FileOutputStream(”Forest.ser”); ObjectOutputStream os = new ObjectOutputStream(fs); os.writeObject(f); os.close(); } catch (Exception ex) { ex.printStackTrace(); } } } class Tree { } What is the result?() A、 Compilation fails.B、 An exception is thrown at runtime.C、 An instance of Forest is serialized.D、 A instance of Forest and an instance of Tree are both serialized.
单选题在下列程序的空白处,应填入的正确选项是( )。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
单选题import java.io.*; public class Forest implements Serializable { private Tree tree = new Tree(); public static void main(String [] args) { Forest f= new Forest(); try { FileOutputStream fs = new FileOutputStream(”Forest.ser”); ObjectOutputStream os = new ObjectOutputStream(fs); os.writeObject(f); os.close(); } catch (Exception ex) { ex.printStackTrace(); } } } class Tree { } What is the result?()A Compilation fails.B An exception is thrown at runtime.C An instance of Forest is serialized.D A instance of Forest and an instance of Tree are both serialized.
单选题阅读下列Java语句:ObjectOutputStream out=new ObjectOutputStream(new ______(employee.dat));在下画线处,应填的正确选项是( )。AFileBFileWriterCFileOutputStreamDOutputStream
单选题下列代码将对象写入的设备是( )。ByteArrayOutputStream bout = new ByteArrayOutputStream();ObjectOutputStream out = new ObjectOutputStream(bout);Out.writeObject(this);Out.close();A内存B硬盘C屏幕D网络
单选题阅读下列代码段:ByteArrayOutputStream bout=new ByteArrayOutputStream();ObjectOutputStream out=new ObjectOutputStream(bout);out.writeObject(this);out.close();以上代码段的作用是( )。A将对象写入内存B将对象写入硬盘C将对象写入光盘D将对象写入文件