你看看Jbuilder 6 的DEMO的TextEdit的代码吧!
    或许有结果

解决方案 »

  1.   

    这个做法是没有问题的,看看是不是名字错了,或者多了什么符号?
    c:\exemple  是不是应该为 c:\example
      

  2.   

    你到dos方式下dir看看你的c:\exemple目录下的文件
    怀疑是不是input.txt.txt啊?刚才运行你的代码了,我这正常,输出“file    found”
      

  3.   

    不是这的错把
    你看我的结果:
    D:\exemple>java file
    enter directory
    d:\exemple
    enter file name
    liuyc.java
    file  not found
    我的文件下的确有这个文件
    我用引数传递参数 import java.io.*;
    class fileInfo{ public static void main(String args[]) throws IOException{
     File fileToCheck;
       if (args.length>0)
       { for (int i=0;i<args.length;i++)
       { fileToCheck = new File(args[i]);
        info (fileToCheck); } } 
        else{ System.out.println("No file given."); } } 
      public  static void info (File f) throws IOException {
         System.out.println("Name: "+f.getName());
          System.out.println("Path: "+f.getPath());
           if (f.exists()) { System.out.println("File exists.");
            System.out.print((f.canRead() ?" and is Readable":"")); 
            System.out.print((f.canWrite()?" and is Writeable":"")); 
            System.out.println(".");
             System.out.println("File is " + f.length() + " bytes."); } 
            else { System.out.println("File does not exist."); } } } 运行结果是:
    D:\exemple>java fileInfo d:\exemple\liuyc.java
    Name: liuyc.java
    Path: d:\exemple\liuyc.java
    File exists.
     and is Readable and is Writeable.
    File is 244 bytes.
    我真的高不懂上面的那个程序到底是哪错了