Created
July 11, 2012 13:27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.com.ocjp.io; | |
import java.io.File; | |
import java.io.IOException; | |
public class ClassFile { | |
public static void main(String[] args) { | |
File f = new File("C:\\temp\\file.txt"); // There is no file yet. | |
System.out.println("Does the file exist? " + f.exists()); | |
try { | |
boolean flag = f.createNewFile(); // May Create a real file | |
System.out.println("File has been created " + flag); | |
System.out.println("Does the file exist? " + f.exists()); | |
} catch (IOException e) {} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment