import java.io.*; public class FileInputOutput { public static void main (String[] args) throws Exception { if (args.length < 2) { System.err.println( "使用方法: java FileInputOutput " + "コピー元 コピー先"); return; } final int BUF_SIZE = 1024; byte buf[] = new byte[BUF_SIZE]; int numBytes; try { FileInputStream fis = new FileInputStream(args[0]); FileOutputStream fos = new FileOutputStream(args[1]); while ((numBytes = fis.read(buf)) != -1) { fos.write(buf, 0, numBytes); } fis.close(); fos.close(); } catch (Exception e) { System.err.println(e); } } } % java basic.FileInputOutput ttt aaa java.io.FileNotFoundException: ttt (指定されたファイルが見つかりません。) count = 0, total = 48 % java basic.FileInputOutput application aaa java.io.FileNotFoundException: application (アクセスが拒否されました。) count = 0, total = 48