Click here to watch in Youtube :
https://www.youtube.com/watch?v=Atxf3c64gPM&list=UUhwKlOVR041tngjerWxVccw
FileDemo.java
Outputhttps://www.youtube.com/watch?v=Atxf3c64gPM&list=UUhwKlOVR041tngjerWxVccw
FileDemo.java
import java.io.File; import java.io.IOException; /* * Create a new file. */ public class FileDemo { public static void main(String[] args) throws IOException { File file = new File("D:/work/myfile.txt"); /* * Atomically creates a new, empty file named by * this abstract pathname if and only if a file with * this name does not yet exist. * * Returns: true if the named file does not exist * and was successfully created; false if the named * file already exists */ if (file.createNewFile()) { System.out.println("File is created!"); } else { System.out.println("File already exists."); } } }
File is created!
https://sites.google.com/site/ramj2eev1/home/javabasics/JavaIODemo_File_create_App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/JavaIODemo_File_create_App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/882ffbbbc9c8fbb765fb4869059bc3ee253ad31b/BasicJava/JavaIODemo_File_create_App/?at=master
See also:
No comments:
Post a Comment