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

📄 filedemo9.java

📁 JAVA程序设计课程中各章节的程序实例。
💻 JAVA
字号:
/**
*This is a program that uses FileOututStream to write a string to the file called Bob.txt
*The contents of the file are displayed on the screen using the type command on the command prompt
*You can use "type + filename.txt" to see the content of the file!
*2004.12.30. xhcprince
*/

import java.io.*;

class fileDemo9
{
	public static void main(String args[]) throws IOException
	{
		byte[] b = new byte[111];

		System.out.println("Enter a string which will be saved to disk:");

		int bytes = System.in.read(b);
		FileOutputStream fout = new FileOutputStream("D:/my.doc");
	/*----------------------------------------------------------------------------------------------
		The file should be actual exist,or there may be an Exception!
		It won't be created automatically!
	----------------------------------------------------------------------------------------------*/
		fout.write(b,0,bytes);
	}
}

⌨️ 快捷键说明

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