Hi everyone,
The following class copies the file of "app1.java" and renames the new file "WelcomeApplet3.java". However, it does not delete "app1" after copied. I wonder why? Thanks.
import java.io.*;
public class CFtest {
public static void main(
String[] args) {
try {
File inputFile = new
File("c:/windows/desktop/app1.java");
File outputFile = new
File("c:/windows/desktop/WelcomeApplet3.java");
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
LineNumberReader lnr = new LineNumberReader(in);
String s;
while ( (s = lnr.readLine()) != null ) {
System.out.println(lnr.getLineNumber() + "==> " + s );
out.write(s);
}
if (inputFile.exists ())
{
inputFile.delete ();}
lnr.close();
in.close();
out.close();
}
catch (IOException ie) { System.out.println("input/output error");
}
}
}