| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 484 人关注过本帖
标题:简单的io问题
只看楼主 加入收藏
越野骏驹
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2007-9-8
收藏
 问题点数:0 回复次数:0 
简单的io问题
先看程序:import
public class TestFile
{
    public static void main(String args[])
    {
        String dirname="\\java";
        File f = new File(dirname);
        
        if(f.isDirectory())
        {
            System.out.println("*****dirtory of "+dirname+"******");
            String s[] = f.list();
            System.out.println("-----The file under the directory of "+dirname+"-----");
            for(int i = 0; i<s.length; i++)
              {
                  File f1 = new File(s[i]);
                  
                  if(f1.isFile())
                  {
                      
                     System.out.println(s[i]+"   绝对路径:"+f1.getAbsolutePath(f1));
                }
                     
              }
             System.out.println("-----The directory under the directory of "+dirname+"-----");
            for(int j = 0 ;j<s.length;j++)
            {
                File f1 = new File(s[j]);
                if(f1.isDirectory())
                {
                    
                    System.out.println(s[j]);
                    }
            }
                
        }
        else
         System.out.println(dirname+"is a File");    
        
    }
    
}


果是这样的:
TestFile.java:21: 无法将 中的 getAbsolutePath() 应用于 (
e)
    System.out.println(s[i]+"   绝对路径:"+f1.getAbsolutePath(f1));
                                                                        ^
1 错误
这怎么解决???
搜索更多相关主题的帖子: public import java file 
2008-04-19 08:06
快速回复:简单的io问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.044837 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved