在J2EE中,下面代码中,()不会编译错误。 A、File f = new File("/","autoexec.bat");B、DataInputStream din = new DataInputStream(new FileInputStream("autoexec.bat"));C、InputStreamReader in = new InputStreamReader(System.in);D、OutputStreamWriter out = new OutputStreamWriter(System.in);
在J2EE中,下面代码中,()不会编译错误。
- A、File f = new File("/","autoexec.bat");
- B、DataInputStream din = new DataInputStream(new FileInputStream("autoexec.bat"));
- C、InputStreamReader in = new InputStreamReader(System.in);
- D、OutputStreamWriter out = new OutputStreamWriter(System.in);
相关考题:
在J2EE中,某一java程序中有如下代码:DataInputStream din=new DataInputStream(new BufferedInputStream(new FileInputStream("employee.dat")));System.out.print(din.readByte());假设在employee.dat文件中只有如下一段字符:abcdefg。则:System.out在屏幕上打印()。A.aB.bC.97D.98
下列InputStream构造方法正确的是()。 A、InputStream in=new FileReader(“file.txt”)B、InputStream in=new FileInputStream(“file.txt”)C、InputStream in=new InputStreamFileReader (“file.txt”,“read”)D、FileInputStream in=new FileReader(new File(“file.txt”))
在程序中,用户输入一个文件名,根据用户输入显示相应文件的信息。注意:请勿修改main()主方法和其他已有语句内容,仅在横线处填入适当语句。______java.io.*;public class basic{public static void main(String[] args){InputStreamReader reader;BufferedReader in;System.out.println("请输入文件名: ");try{reader=new InputStreamReader(______);in=new BufferedReader(reader);String filename=in.readLine();File file=new File(filename);System.out.println("文件名:"+file.______);System.out.println("路径:"+file.getAbsolutePath());System.out.println("大小:"+file.length());}catch(Exception e){e.printStackTrace();}}}
在J2EE中,下面的代码中出现编译错误的是()。A.Filef=newFile("/","autoexec.bat");B.DataInput Streamdin=new Data Input Stream(new File Input Stream("autoexec.bat"));C.Input Stream Readerin=new Input Stream Reader(System.in);D.Output Stream Writer out=new Output Stream Writer(System.in);
在J2EE中,为了使得在客户端可以接收用户在控制台上的键盘输入,且把键盘输入发送到服务器,同时还要接收服务器给客户端的反馈,需要构造三个用于输入输出的对象变量,以下代码符合要求的是()。其中clientSocket是一个Socket类的对象。 A、BufferedRead br1 = System.in; BufferedRead br2 = new BufferedReader(clientSocket.getInputStream())); PrintStream ps = new PrintStream(clientSocket.getOutputStream());B、BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in));BufferedReader br2 = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));PrintStream ps = new PrintStream(clientSocket.getOutputStream());C、 BufferedRead br1 = new InputStreamReader(System.in); BufferedReader br2 = newInputStreamReader(clientSocket.getInputStream()); PrintStream ps = new PrintStream(clientSocket.getOutputStream());D、 BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in));BufferedReader br2 = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); PrintStream ps = clientSocket.getOutputStream();
在J2EE中,以下各项中,()正确阐述了创建inputstreamreader的方式 A、new InputStreamReader(new FileInputStream(“data”))B、new InputStreamReader (new FileReader(“data”))C、new InputStreamReader (new BufferedReader(“data”))D、new InputStreamReader ( “data”)
在J2ee中,以下各项中,()正确阐述了创建InputStreamReader的方式。 A、new InputStreamReader(new FileInputStream("data"));B、new InputStreamReader(new FileReader"data"));C、new InputStreamReader(new BufferedReader("data"));D、new FileInputStream("data")
在J2EE中,利用下列构造函数准备对文件abc.txt操作,但文件abc.txt在当前目录不存在,不会产生运行时错误的是()。 A、BufferedReader breader=new BufferedReader(new FileReader("abc.txt"));B、PrintWriter out = new PrintWriter(new FileWriter(“abc.txt”),true);C、FileInputStream fin = new FileInputStream(“abc.txt”);D、OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(“abc.txt”));
J2EE中,以下各项中,()正确阐述了创建InputStreamReader的方式。A、new InputStreamReader(new FileInputSteream(“data”));B、new InputStreamReader(new FileFileReader (“data”));C、new InputStreamReader(new BufferedReader(“data”));D、new InputStreamReader(“data”);
Which two construct an OutputSream that appends to the file “file.txt”? ()A、 OutputStream out=new FileOutputStream(“file.txt”);B、 OutputStream out=new FileOutputStream(“file.txt”, “append”);C、 FileOutputStream out=new FileOutputStream(“file.txt”, true);D、 FileOutputStream out=new FileOutputStream(new file(“file.txt”));E、 OutputStream out=new FileOutputStream(new File(“file.txt”)true);
Which constructs a DataOutputStream?() A、 New dataInputStream(“in.txt”);B、 New dataInputStream(new file(“in.txt”));C、 New dataInputStream(new writer(“in.txt”));D、 New dataInputStream(new FileWriter(“in.txt”));E、 New dataInputStream(new InputStream(“in.txt”));F、 New dataInputStream(new FileInputStream(“in.txt”));
要从文件" file.dat"文件中读出第10个字节到变量C中,下列哪个方法适合? ()A、 FileInputStream in=new FileInputStream("file.dat"); in.skip(9); int c=in.read();B、 FileInputStream in=new FileInputStream("file.dat"); in.skip(10); int c=in.read();C、 FileInputStream in=new FileInputStream("file.dat"); int c=in.read();D、 RandomAccessFile in=new RandomAccessFile("file.dat"); in.skip(9); int c=in.readByte();
要从文件"file.dat"中读出第10个字节到变量c中,下列哪个方法适合?()A、FileInputStream in=new FileInputStream("file.dat");in.skip(9);intc=in.read()B、FileInputStream in=new FileInputStream("file.dat");in.skip(10);intc=in.read()C、FileInputStream in=new FileInputStream("file.dat");intc=in.read()D、RandomAccessFile in=new RandomAccessFile("file.dat");in.skip(9);intc=in.readByte()
Which two create an InputStream and open file the “file.txt” for reading? ()A、 InputStream in=new FileReader(“file.txt”);B、 InputStream in=new FileInputStream(“file.txt”);C、 InputStream in=new InputStreamFileReader (“file.txt”, “read”);D、 FileInputStream in=new FileReader(new File(“file.txt”));E、 FileInputStream in=new FileInputStream(new File(“file.txt”));
Which method implementations will write the given string to a file named "file", using UTF8 encoding?() IMPLEMENTATION a: public void write(String msg) throws IOException { FileWriter fw = new FileWriter(new File("file")); fw.write(msg); fw.close(); } IMPLEMENTATION b: public void write(String msg) throws IOException { OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("file"), "UTF8"); osw.write(msg); osw.close(); } IMPLEMENTATION c: public void write(String msg) throws IOException { FileWriter fw = new FileWriter(new File("file")); fw.setEncoding("UTF8"); fw.write(msg); fw.close(); } IMPLEMENTATION d: public void write(String msg) throws IOException { FilterWriter fw = FilterWriter(new FileWriter("file"), "UTF8"); fw.write(msg); fw.close(); } IMPLEMENTATION e: public void write(String msg) throws IOException { OutputStreamWriter osw = new OutputStreamWriter( new OutputStream(new File("file")), "UTF8" ); osw.write(msg); osw.close(); } A、Implementation a.B、Implementation b.C、Implementation c.D、Implementation d.E、Implementation e.
多选题在J2EE中,利用下列构造函数准备对文件abc.txt操作,但文件abc.txt在当前目录不存在,不会产生运行时错误的是()。ABufferedReader breader=new BufferedReader(new FileReader(abc.txt));BPrintWriter out = new PrintWriter(new FileWriter(“abc.txt”),true);CFileInputStream fin = new FileInputStream(“abc.txt”);DOutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(“abc.txt”));
单选题在J2EE中,以下各项中,()正确阐述了创建inputstreamreader的方式Anew InputStreamReader(new FileInputStream(“data”))Bnew InputStreamReader (new FileReader(“data”))Cnew InputStreamReader (new BufferedReader(“data”))Dnew InputStreamReader ( “data”)
单选题在j2ee中,某一Java程序中有如下代码: DataInputStream din =new DataInputStream(new BufferedInputStream(new FileInputStream("employee.dat"))); System.out.print(din.readByte()); 假设在employee.dat文件中只有如下一段字符:abcdefg.则:System.out在屏幕上打印()A aB bC97D98
单选题在J2ee中,以下各项中,()正确阐述了创建InputStreamReader的方式。Anew InputStreamReader(new FileInputStream(data));Bnew InputStreamReader(new FileReaderdata));Cnew InputStreamReader(new BufferedReader(data));Dnew FileInputStream(data)
单选题J2EE中,以下各项中,()正确阐述了创建InputStreamReader的方式。Anew InputStreamReader(new FileInputSteream(“data”));Bnew InputStreamReader(new FileFileReader (“data”));Cnew InputStreamReader(new BufferedReader(“data”));Dnew InputStreamReader(“data”);
单选题Which method implementations will write the given string to a file named "file", using UTF8 encoding?() IMPLEMENTATION a: public void write(String msg) throws IOException { FileWriter fw = new FileWriter(new File("file")); fw.write(msg); fw.close(); } IMPLEMENTATION b: public void write(String msg) throws IOException { OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream("file"), "UTF8"); osw.write(msg); osw.close(); } IMPLEMENTATION c: public void write(String msg) throws IOException { FileWriter fw = new FileWriter(new File("file")); fw.setEncoding("UTF8"); fw.write(msg); fw.close(); } IMPLEMENTATION d: public void write(String msg) throws IOException { FilterWriter fw = FilterWriter(new FileWriter("file"), "UTF8"); fw.write(msg); fw.close(); } IMPLEMENTATION e: public void write(String msg) throws IOException { OutputStreamWriter osw = new OutputStreamWriter( new OutputStream(new File("file")), "UTF8" ); osw.write(msg); osw.close(); }AImplementation a.BImplementation b.CImplementation c.DImplementation d.EImplementation e.
多选题Which two create an InputStream and open file the “file.txt” for reading? ()AInputStream in=new FileReader(“file.txt”);BInputStream in=new FileInputStream(“file.txt”);CInputStream in=new InputStreamFileReader (“file.txt”, “read”);DFileInputStream in=new FileReader(new File(“file.txt”));EFileInputStream in=new FileInputStream(new File(“file.txt”));
单选题在J2EE中,为了使得在客户端可以接收用户在控制台上的键盘输入,且把键盘输入发送到服务器,同时还要接收服务器给客户端的反馈,需要构造三个用于输入输出的对象变量,以下代码符合要求的是()。其中clientSocket是一个Socket类的对象。ABufferedRead br1 = System.in; BufferedRead br2 = new BufferedReader(clientSocket.getInputStream())); PrintStream ps = new PrintStream(clientSocket.getOutputStream());BBufferedReader br1 = new BufferedReader(new InputStreamReader(System.in));BufferedReader br2 = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));PrintStream ps = new PrintStream(clientSocket.getOutputStream());C BufferedRead br1 = new InputStreamReader(System.in); BufferedReader br2 = newInputStreamReader(clientSocket.getInputStream()); PrintStream ps = new PrintStream(clientSocket.getOutputStream());D BufferedReader br1 = new BufferedReader(new InputStreamReader(System.in));BufferedReader br2 = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); PrintStream ps = clientSocket.getOutputStream();
单选题Which constructs a DataOutputStream?()A New dataInputStream(“in.txt”);B New dataInputStream(new file(“in.txt”));C New dataInputStream(new writer(“in.txt”));D New dataInputStream(new FileWriter(“in.txt”));E New dataInputStream(new InputStream(“in.txt”));F New dataInputStream(new FileInputStream(“in.txt”));
多选题Which two construct an OutputSream that appends to the file “file.txt”? ()AOutputStream out=new FileOutputStream(“file.txt”);BOutputStream out=new FileOutputStream(“file.txt”, “append”);CFileOutputStream out=new FileOutputStream(“file.txt”, true);DFileOutputStream out=new FileOutputStream(new file(“file.txt”));EOutputStream out=new FileOutputStream(new File(“file.txt”)true);
单选题在J2EE中,某一java程序中有如下代码: DataInputStream din=new DataInputStream(new BufferedInputStream (new FileInputStream("employee.dat"))); System.out.print(din.readByte()); 假设在employee.dat文件中只有如下一段字符:abcdefg。则:System.out在屏幕上打印()。AaBbC97D98
多选题在J2EE中,下面代码中,()不会编译错误。AFile f = new File(/,autoexec.bat);BDataInputStream din = new DataInputStream(new FileInputStream(autoexec.bat));CInputStreamReader in = new InputStreamReader(System.in);DOutputStreamWriter out = new OutputStreamWriter(System.in);