?? writetxt.java
字號:
import java.io.File;
import java.io.FileOutputStream;
public class Writetxt {
public void DOWriteTxt(String file, String txt) {
try {
//寫入文件尾
FileOutputStream os = new FileOutputStream(new File(file), true);
//覆蓋
//FileOutputStream os = new FileOutputStream(new File(file), false);
//os.write((txt + "\n").getBytes());
//這里不需要換行,換行另處理
os.write((txt).getBytes());
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
new Writetxt().DOWriteTxt("D:\\問好.txt", "你好!");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -