Java.io.Writer.write char() 方法


Java.io.Writer.write char() 方法

package com.codingdict;



import java.io.*;



public class WriterDemo {



   public static void main(String[] args) {

      int c = 70;



      // create a new writer

      Writer writer = new PrintWriter(System.out);



      try {



         // write an int that will be printed as ASCII

         writer.write(c);



         // flush the writer

         writer.flush();



         // write another int that will be printed as ASCII

         writer.write(71);



         // flush the stream again

         writer.flush();



      } catch (IOException ex) {

         ex.printStackTrace();

      }

   }

}