?? writefileexample.java
字號:
package javaio;
import java.io.*;
public class WriteFileExample
{
public static void main(String[] args)
{
try
{
File aFile=new File("WriteExample.txt"); //指定文件名
//建立輸出流
FileOutputStream out= new FileOutputStream(aFile); byte[] b=new byte[1024];
String str="This is a test file";
b=str.getBytes(); //進(jìn)行String到byte[]的轉(zhuǎn)化
out.write(b); //寫入文本內(nèi)容
}
catch (IOException e)
{
System.out.println(e.toString());
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -