posts - 495,  comments - 11,  trackbacks - 0

          import java.io.*;

          public class FileReadTest
          {
          public static void main(String[] args)
          {
          ?? FileReadTest t = new FileReadTest();
          ?? t.readMyFile();
          }
          void readMyFile()
          {
          ?? String temp = null;
          ?? int count = 0;
          ?? try
          ?? {
          ??? FileReader fr = new FileReader("mydata.txt");
          ??? BufferedReader br = new BufferedReader(fr);
          ??? temp = new String();
          ??? while((temp = br.readLine()) != null)
          ??? {
          ???? count++;
          ???? System.out.println(count + ":" + temp);
          ??? }
          ??? br.close();
          ??? fr.close();
          ?? }
          ?? catch(IOException e)
          ?? {
          ??? System.out.println("OH,got an IOException error!");
          ??? e.printStackTrace();
          ?? }
          }
          }

          posted on 2007-05-28 00:32 jadmin 閱讀(50) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 嘉鱼县| 景宁| 舞钢市| 武功县| 泰和县| 岗巴县| 岢岚县| 贵定县| 黄大仙区| 盈江县| 临西县| 遂平县| 盐源县| 子洲县| 麟游县| 大渡口区| 枝江市| 高唐县| 嵊州市| 尤溪县| 胶州市| 大安市| 新绛县| 江达县| 济南市| 黄陵县| 得荣县| 嘉定区| 广昌县| 苍溪县| 岳西县| 南部县| 鄂温| 北票市| 盐边县| 潞西市| 海原县| 乡宁县| 乌兰浩特市| 武鸣县| 白朗县|