从File对象创建FileOutputStream对象
import java.io.File;//时 代 J a v a 公 众 号 - nowjava.com import java.io.FileNotFoundException; import java.io.FileOutputStream; public class Main { public static void main(String[] args) { File file = new File("C:/Folder/demo.txt"); try { FileOutputStream fos = new FileOutputStream(file); } catch (FileNotFoundException ex) { System.out.println("Exception : " + ex); } } }