集册 Java实例教程 从字符串文件路径创建FileOutputStream对象

从字符串文件路径创建FileOutputStream对象

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

425
从字符串文件路径创建FileOutputStream对象

 /* 来自 N o w J a v a . c o m - 时代Java*/

import java.io.*;

 

public class Main {

 

  public static void main(String[] args) {

   

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

   

     try

     {

       FileOutputStream fos = new FileOutputStream(strFilePath);

     }

     catch(FileNotFoundException ex)

     {

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

     }

  }

}