【单选题】阅读下段代码 import java.io.*; public class Example{ public static void main(String[] args) throws Exception { FileInputStream fis = new FileInputStream("file.txt"); FileOutputStream fos = n
举一反三
- 阅读下段代码 import java.io.*; public class Example{ public static void main(String[] args) throws Exception { FileInputStream fis = new FileInputStream("file.txt"); FileOutputStream fos = new FileOutputStream("copy_file.txt"); int ch = 0; while((ch =fis.read())!=-1){ fos.write(ch); } fos._______; fis.close(); } } 请说出下划线上,填写的方法名称
- 阅读下段代码import java.io.*;public class Example{public static void main(String[] args) throws Exception {FileInputStream fis = new FileInputStream("file.txt");FileOutputStream fos = new FileOutputStream("copy_file.txt");int ch = 0;while((ch =fis.read())!=-1){fos.write(ch);}fos._______;fis.close();}}请说出下划线上,填写的方法名称( ) A: write() B: close() C: available() D: read()
- 阅读下列代码 import java.io.*; public class Example { public static void main(String[] args) throws Exception { FileInputStream in = new FileInputStream("itcast.txt"); int b = 0; while (true) { b = in.______; if (b == -1) { break; } System.out.println(b); } in.close() } } 请说出下划线上,填写的方法名称
- 如果在一台 PC 机的c:\source目录运行如下代码: import java.io.*; class Path { public static void main(String[] args) throws Exception { File file = new File('Ran.test'); System.out.println(file.getAbsolutePath()); } } 则,期望的输出结果为?
- 下面代码的运行结果为:( ) import java.io.*; import java.util.*; public class foo{ public static void main (String[] args){ String s; System.out.println("s=" + s); } }