I need to skip my very first line from the txt file, but I can't seem to find any solution to this as I only want my team names
My file is currently:
teamName, teamPlayers
teamA, 1, 2, 3, 4
teamB, 1, 2, 3, 4
AND can I count the lines? So in another method it can go on if it has three lines (to teams)?
public static void readGameData() { String path = "src/teamData.txt"; String teamNamesFile = ""; try{ BufferedReader br = new BufferedReader(new FileReader(path)); while((teamNamesFile = br.readLine()) != null){ String [] teamNames = teamNamesFile.split(","); if(teamNamesFile.equals ("teamName"); System.out.println("This is from file :" + teamNames[0]); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }