集册 Java实例教程 使用FileOutputStream写入文件

使用FileOutputStream写入文件

欢马劈雪     最近更新时间:2020-01-02 10:19:05

384
使用FileOutputStream写入文件


import java.io.*;/**时 代 J a v a - nowjava.com**/

 

public class Main {

 

  public static void main(String[] args) {

   

     String strFilePath = "C://Folder//demo.txt";

   

     try

     {

      FileOutputStream fos = new FileOutputStream(strFilePath);

      byte b = 01;

     

       fos.write(b);
       /**
        * 时 代 J a v a - nowjava.com 提 供 
       **/

     

       fos.close();

     }catch(FileNotFoundException ex){

      System.out.println("FileNotFoundException : " + ex);

     }

     
展开阅读全文