Did you run the code? What happened when you run the code, any exception comes?
finally {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
}
This is better as otherwise NPE could come.
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
If I import directly
import java.io.*;
Import specific class which requires not all