📄 filedemo9.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 + -