/* File TestFileClass.java to test show the use of * some of the methods in class File. * * Carsten Butz, October 2002. */ import java.io.*; class TestFileClass{ public static void main(String[] args) throws IOException{ /* Basic message */ System.out.println("\n\nSome information about this file:"); /* Abbreviation for some file, actually this one */ String thisFile = "TestFileClass.java"; /* Create a new file object and print information about this object */ File tf = new File(thisFile); System.out.println("The file " + thisFile + " exists: " + tf.exists()); System.out.println("We can write to the file " + thisFile + ": " + tf.canWrite()); System.out.println("Absolute path: " + tf.getAbsolutePath()); System.out.println("Canonical path: " + tf.getCanonicalPath()); System.out.println("Path: " + tf.getPath()); System.out.println("\n\nSystem dependent separators:"); System.out.println("Name separator: " + File.separator); System.out.println("Path separator: " + File.pathSeparator); /* Next we do directory listing */ System.out.println("\n\nDirectory listing:"); File directory = new File("."); String[] dir; dir = directory.list(); /* Printing the array of Strings */ for(int i = 0; i