import java.io.IOException; public class res1 implements ires { public void write(String filename, String msg) throws IOException { FileOutputStream out = new FileOutputStream(filename); // may throw FileNotFoundException FileOutputStream log = new FileOutputStream("log.txt"); // or SecurityException out.write(msg.getBytes()); // may throw an IOException log.write(msg.getBytes()); // may throw an IOException log.close(); // may throw an IOException out.close(); // may throw an IOException } public static void main(String[] args) { res.dotest(new res1()); } }