📄 filedemo12.java
字号:
/**
*This is another sample program that uses FileInputStream and FileOutputStream
* along with the class File.
*The program creates a backup file for this java file,the name of the backup file's called
* backup.txt.When you run the program,backup.txt is created inside the directory
* where this program is saved
*2004.12.30. xhcprince
*/
import java.io.*;
class fileDemo12
{
public static void main(String args[])throws IOException
{
File f1 = new File("fileDemo12.java");
if(f1.exists()==true && f1.isFile()==true)
{
FileInputStream fin = new FileInputStream(f1);
FileOutputStream fout = new FileOutputStream("backup.txt");
int len = (int)f1.length();
int i;
for(i=1; i<=len; ++i)
{
char ch = (char)fin.read();
fout.write(ch);
}
fin.close();
fout.flush();
fout.close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -