[填空题] 请在下列程序的空白处,填上适当的内容: Import java. awt. *; Import java. util. *; Class BufferTest{ Public st
15 查阅
[填空题] 请在下列程序的空白处,填上适当的内容: Import java. awt. *; Import java. util. *; Class BufferTest{ Public static void main(string args[]) Throws IOException{ FileOutputStream unbuf= new FileOutputStream(“test.one”) ; BufferedOutputStream buf= new 【11】 (new FileOutputStream(“test.two”)); System.out.println (“write file unbuffered: ” + time(unbuf) + “ms”); System.out.println (“write file buffered: ” + time(buf) + “ms”); } Static int time (OutputStream os) Throws IOException{ Date then = new Date(); for (int i=0; i<50000; i++){ os.write(1); } } os.close(); return(int)(()new Date()).getTime() - then.getTime()); }
参考答案: