1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
/* Create FileOutputStream object from String file path This example shows how to create FileOutputStream object from String containing file path. */ import java.io.*; public class CreateFileOutputStreamObjectFromString { public static void main(String[] args) { String strFilePath = "C://FileIO//demo.txt"; /* * To create FileOutputStream object from String use, * FileOutputStream(String filePath) constructor. */ try { FileOutputStream fos = new FileOutputStream(strFilePath); } catch(FileNotFoundException ex) { System.out.println("Exception : " + ex); } } } |
Add Comment