zoukankan      html  css  js  c++  java
  • java FileWriter and FileReader

    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.IOException;
    public class FWFRDemo
    {
    final static String MSG = "Test message";
    public static void main(String[] args) throws IOException
    {
    try (FileWriter fw = new FileWriter("temp"))
    {
    fw.write(MSG, 0, MSG.length());
    }
    char[] buf = new char[MSG.length()];
    try (FileReader fr = new FileReader("temp"))
    {
    fr.read(buf, 0, MSG.length());
    System.out.println(buf);
    }
    }
    }
  • 相关阅读:
    面向对象
    面向对象
    面向对象
    面向对象
    面向对象
    面向对象
    面向对象
    面向对象
    3.1
    面向对象
  • 原文地址:https://www.cnblogs.com/rojas/p/5408357.html
Copyright © 2011-2022 走看看