在这个while语句中while ((c = in.read()) != -1)
-1是什么意思?有关详细信息,请参阅以下计划:
import java.*;
public class CopyFile
{
public static void main(String args[]) throws IOException
{
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream("input.txt ");
out = new FileOutputStream("output.txt");
int c;
while ((c = in.read()) != -1)
{
out.write(c);
}
}
finally
{
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
}
}
}