자바 csv 특정 라인부터 읽는법

fati10의 이미지

csv파일을 읽어오는데 첫번 째 라인을 제외하고 두번째 라인부터 읽을려고 하는데 어떻게 읽어야 할지 모르겠습니다.

Scanner sc = new Scanner(f); //파일을 scanner로 불어옴.

List people = new ArrayList();

while(sc.hasNextLine()){
String line = sc.nextLine();

String[] details = line.split(",");

String rank = details[0];
String discipline = details[1];
int phd = Integer.parseInt(details[2]);
int service = Integer.parseInt(details[3]);
String sex = details[4];
int salary=Integer.parseInt(details[5]);

Person p = new Person(rank, discipline, phd, service, sex, salary);
people.add(p);
}

raymundo의 이미지

루프 들어가기 전에
sc.nextLine();
를 한 번 호출하셔서 읽고 지나치면 되죠.

좋은 하루 되세요!