浙 江 工 业 大 学 考 试 命 题 纸
答 题 纸(4)
编程题第2题: import java.io.*; public class CopyFile { public static void main(String[] args) { copy(); } public static void copy() { FileWriter fw = null; FileReader fr = null; BufferedWriter bfw = null; BufferedReader bfr = null; try { fw = new FileWriter(\ fr = new FileReader(\ bfw = new BufferedWriter(fw); bfr = new BufferedReader(fr); String line = null; while ((line = bfr.readLine()) != null) { bfw.write(line.toUpperCase()); bfw.newLine(); bfw.flush(); } System.out.println(\ } catch (IOException e) { System.out.println(e.toString()); } finally { if (bfw != null) { try { bfw.close(); } catch (IOException e) { System.out.println(e.toString()); } } if (bfr != null) { try { bfr.close(); } catch (IOException e) { System.out.println(e.toString()); } } } } 第 15 页
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库浙江工业大学2012_Java程序设计期终考卷(2010级计算机)答案(4)在线全文阅读。
相关推荐: