正在加载图片...
Bad smell ●Hand| e-Bad smell ● Dummy handler e public void write File(String fileName, String data) Writer writer null ●●●● try t /may throw an IOEXception * writer new FileWriter(fileName) / may throw an IOEXception * writer.write(data); catch(IOEXception er e print StackTraceO /or System. out. printIn(e to String) finally/* code for cleanup *1Bad Smell Handle——Bad Smell:  Dummy handler public void writeFile(String fileName, String data){ Writer writer = null; try { /* may throw an IOException */ writer = new FileWriter(fileName); /* may throw an IOException */ writer.write(data); } catch (IOException e){ e.printStackTrace(); // or System.out.println(e.toString()); } finally {/* code for cleanup */} }
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有