top of page
  • doorkposentlightec

Pershkrimi Subjektiv I Nje Personi Wikipedia Zip Halpeke







I would like to get to the following list: Id,Name,BirthDay 1,Sam,02.02.1994 2,Steve,26.05.1982 3,Tom,25.11.1985 4,Peter,23.01.1970 5,Sasha,13.01.1981 Then I would like to sort this list by the birthdays, so the resulting list would be Id,Name,BirthDay 5,Sasha,13.01.1981 1,Sam,02.02.1994 2,Steve,26.05.1982 3,Tom,25.11.1985 4,Peter,23.01.1970 A: Please use code as below. String fname = "C:\input\try.txt"; try { BufferedReader br = new BufferedReader(new FileReader(fname)); String line = ""; int id = 1; String name = ""; String birthday = ""; while ((line = br.readLine())!= null) { String[] token = line.split(","); if (token.length == 3) { id = Integer.parseInt(token[0]); name = token[1]; birthday = token[2]; System.out.println(id + " " + name + " " + birthday); } } br.close(); } catch (IOException e) { e.printStackTrace(); } The file should be as below. Id,Name,BirthDay 1, ac619d1d87


Related links:

5 views0 comments

Recent Posts

See All
bottom of page