public class FileTest extends Frame{
File name;
TextField enter;
TextArea output;
public FileTest(){
super("Testing class File");
setLayout(new BorderLayout());
enter =new TextField("Enter file or directory name here",40);
output=new TextArea(20,30);
add("North",enter);
add("Center",output);
resize(400,400);
show();
}
public boolean action(Event e,Object o){
output.setText("");
name=new File(o.toString());
if(name.exists()){
output.appendText(name.getName()+" exits\n"+(name.isFile() ? "is a file\n" : "is not a file\n")+
(name.isDirectory() ? "is a directory\n" : "is not a directory\n")+
(name.isAbsolute() ? "is absolute path\n" : "is not a absolute path\n")+"Last modified:"+
name.lastModified()+"\nLength:"+name.length()+
"\nPath:"+name.getPath()+"\nAbsolute path:"+name.getAbsolutePath()+
"\nParent:"+name.getParent());