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

📄 ioapp.java

📁 Java中的I/O操作一例
💻 JAVA
字号:
/*
 * Author: Administrator
 * Created: 2004年11月10日 20:15:54
 * Modified: 2004年11月10日 20:15:54
 */

import java.io.*;
import java.sql.Timestamp;
public class IOapp
{
	public static final String FILE="c:\\hello.txt";
	public static void main(String args[])
	{
		try
		{
		FileOutputStream outStr = new FileOutputStream(FILE,true);
		PrintStream printStream = new PrintStream(outStr);
		System.setOut(printStream);
		Timestamp now = new Timestamp(System.currentTimeMillis());
		System.out.println(now.toString()+"---The text to the file");
		outStr.close();
		printStream.close();
		}
		catch(FileNotFoundException e)
		{
			System.out.println(e);
			System.exit(-1);
		}
		catch(IOException e)
		{
			System.out.println(e);
			System.exit(-1);
		}
		
	}
}

⌨️ 快捷键说明

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