📄 filestream2.java
字号:
import java.io.*;
class FileStream2
{
public static void main(String args[])
{
File f=new File("hello.txt");
try
{
FileWriter out = new FileWriter(f);
out.write("hello world");
out.close();
//out.flush();
}
catch(Exception e)
{
e.printStackTrace();
}
try
{
FileReader in = new FileReader(f);
char buf[]=new char[1024];
int len=in.read(buf);
in.close();
if(len<0) len=0;
System.out.println(new String(buf,0,len));
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -