import java.io.*;
public class FileTest {
  public static void main(String[] args) 
                     throws Exception {
    File testFile = new File("test.txt");
    System.out.println(testFile.getName()
                       + (testFile.isFile() 
                          ? " is a file" : " is not a file"));
    File thisDir = new File(".");
    System.out.println("Directory " + thisDir.getAbsolutePath());
    String[] dirListing = thisDir.list();
    System.out.println("  first file is " + dirListing[0]);
  }
}