BufferedReader to skip first line

前端 未结 6 1644
余生分开走
余生分开走 2020-12-24 02:44

I am using the following bufferedreader to read the lines of a file,

BufferedReader reader = new BufferedReader(new FileReader(somepath));
whil         


        
6条回答
  •  一个人的身影
    2020-12-24 03:13

    You can try this

     BufferedReader reader = new BufferedReader(new FileReader(somepath));
     reader.readLine(); // this will read the first line
     String line1=null;
     while ((line1 = reader.readLine()) != null){ //loop will run from 2nd line
            //some code
     }
    

提交回复
热议问题