public class Demo1_FileReader {
//FileReader
public static void main(String[] args) throws IOException {
// demo1();
FileReader fr = new FileReader("yyy");
int a ;
while ((a= fr.read())!=-1) {//通过项目默认的码表一次读取一个字节
System.out.println((char) a);
}
fr.close();
}
public static void demo1() throws FileNotFoundException, IOException {
FileReader fr =new FileReader("yyy");
int a =fr.read();
System.out.println(a);
char c =(char)a;
System.out.println(c);
//FileReader
public static void main(String[] args) throws IOException {
// demo1();
FileReader fr = new FileReader("yyy");
int a ;
while ((a= fr.read())!=-1) {//通过项目默认的码表一次读取一个字节
System.out.println((char) a);
}
fr.close();
}
public static void demo1() throws FileNotFoundException, IOException {
FileReader fr =new FileReader("yyy");
int a =fr.read();
System.out.println(a);
char c =(char)a;
System.out.println(c);
}
//输出
public class Demo2_FileWrite {
public static void main(String[] args) throws IOException {
FileWriter fw =new FileWriter("zzz.txt");
fw.write("大家好,努力坚持 ");
fw.write("asd");
fw.close();
}