我的文件名是:
20050701.txt
20050702.txt
20050703.txt
20050704.txt
20050705.txt
20050706.txt
20050707.txt
第一个文件内容是:
ST:20050701 000011 TI:20050719 000011 CN:06 LT:10 PN:13099885853 DN:1015902210 AR:D KC:- RS:@!!!!!!!
ST:20050701 000011 TI:20050719 000032 CN:06 LT:90 PN:13099885853 DN:1015902210 AR:D KC:* RS:@!!!!!!!
第二个文件内容是:
ST:20050702 000011 TI:20050719 000011 CN:06 LT:10 PN:13099885853 DN:1015902210 AR:D KC:- RS:@!!!!!!!
ST:20050702 000011 TI:20050719 000032 CN:06 LT:90 PN:13099885853 DN:1015902210 AR:D KC:* RS:@!!!!!!!
依次类推
我想用JAVA输入文件名,再查出文件里是LT:90的文件,
(就是我输入:20050701  
能打印出:ST:20050701 000011 TI:20050719 000032 CN:06 LT:90 PN:13099885853 DN:1015902210 AR:D KC:* RS:@!!!!!!!  这一条)
(输入:20050702  
能打印出:ST:20050702 000011 TI:20050719 000032 CN:06 LT:90 PN:13099885853 DN:1015902210 AR:D KC:* RS:@!!!!!!!  这一条)希望高手能给出源码,谢谢

解决方案 »

  1.   

    等等啊。帮早上帮公司做好网站晚上写给你,不过java我也刚开始。抱歉
      

  2.   

    /*关于文件读取的
     *程序
     *@win98+jdk1.5
     *@author:angel421
     */
     
     import java.io.*;
     import java.util.*;
     
     public class Test
     {
      public static void main(String args[])
      {
      String read="";
      String fileName="*";
     
      while(true){
      System.out.println("<<<<<<<<<<<<<<<<<<<<<");
      System.out.println("Files is under the same dir,please input the filename:");
      Scanner get=new Scanner(System.in);
      fileName=get.next();
      if(fileName.equals("quit"))
      {
      System.out.println("exit windows");
      System.exit(0);
      }
     
      System.out.println("your inputed filename is"+fileName);
      System.out.println("begin reading file..............");
      System.out.println("the file is ::::::");
     
      try{
     
      File file=new File(fileName+".txt");
      FileReader fr=new FileReader(file);
      BufferedReader br=new BufferedReader(fr);
     
      while((read=br.readLine())!=null)
      {
      System.out.println(read);
      }
      System.out.println("::::::::::");
      }
      catch(FileNotFoundException e)
      {
      System.out.println("File is not found"+e.getMessage());
      }
      catch(IOException e)
      {
      e.toString();
      }
      }
     }
     }
    剩下的你自己可以扩展啊,