package com.imooc.IO;
import java.io.FileOutputStream;
import java.io.IOException;
public class FileOutDemo {
public static void main(String[] args) throws IOException{
//如果文件不存在,则直接创建;如果文件存在,则删除后创建
FileOutputStream file = new FileOutputStream("C:\\Users\\Administrator\\Desktop\\联.txt");
//在后面加上“true”:如果文件不存在,则直接创建;如果文件存在,则在该文件后添加内容
FileOutputStream file2 = new FileOutputStream("C:\\Users\\Administrator\\Desktop\\联.txt",true);
file.write('A');
file.write('B');
int a = 10;
file.write(a >>> 24);
file.write(a >>> 16);
file.write(a >>> 8);
file.write(a);
byte[] gbk = "中国".getBytes();
file.write(gbk);
file.close();
IOUtil.printHax("C:\\Users\\Administrator\\Desktop\\联.txt");
}
}