⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filestream1.java

📁 这是清华大学编写的JAVA教材中所有题目的源代码!
💻 JAVA
字号:
import java.io.*;

class FileStream1
{
	public static void main(String args[])
	{
		File f=new File("hello.txt");
		try
		{
			FileOutputStream out = new FileOutputStream(f);
			byte buf[]="hello world".getBytes();
			out.write(buf);
			out.close();
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}

		try
		{
			FileInputStream in = new FileInputStream(f);
			byte buf[]=new byte[1024];
			int len=in.read(buf);
			System.out.println(len);
			in.close();
			System.out.println(new String(buf,0,len));
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -