I am reading the text file from java to insert into oracle DB table, how can skip first 2 lines?
I want to skip the first 2 lines from text file.
Code :
BufferdReader bReader = new BufferedReader (new FileReader(/home/test.txt));
String line = "";
while ((line = bReader.readLine ()) !=null)
{
if (line != null)
{
String[] array = line.split(",",-1) ;
for (String arrays : array ) {
System.out.println(arrays );
}
}
}
Add this before your while
:
int ct = 0;
And this before the first if
on the while
:
if(ct < 2) {
ct++;
continue;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.