我的文件名是20050701.txt
            20050702.txt
            20050703.txt
            20050704.txt
            20050705.txt
在运行之后我输入20050701和20050703,之后屏幕上打印出
            20050701.txt
            20050702.txt
            20050703.txt
请各位高手指点一下,谢谢了

解决方案 »

  1.   

    long begin = 20050701;
            long end = 20050703;
            long i = 0;        if ((begin + i <= end) && (new File("" + begin + i)).exists())
            {
                System.out.println(begin + i);
                i += 1;
            }
      

  2.   

    居然发出去了,唉~
    为什么不能加一
    --------------------------------long begin = 20050701;
            long end = 20050703;
            File tmpFile = null;
            
            for (long i=0; begin+i<=end; ++i)
            {
                tmpFile = new File("你的路径" + (begin + i));
                if (tmpFile.exists())
                {
                    System.out.println(tmpFile.getName());
                    tmpFile = null;
                }
            }
      

  3.   

    //写错了个地方
    long begin = 20050701;
            long end = 20050703;
            File tmpFile = null;
            
            for (long i=0; begin+i<=end; ++i)
            {
                tmpFile = new File("你的路径" + (begin + i));
                if (tmpFile.exists())
                {
                    System.out.println(tmpFile.getName());
                }
                tmpFile = null;        }