Last active
May 16, 2020 14:42
-
-
Save dan-dm/a4298e7a23ab483fc20ad3c6cb7b195e to your computer and use it in GitHub Desktop.
Created with Copy to Gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try (Scanner scanner = new Scanner(Paths.get("records.txt"))) { | |
while (scanner.hasNextLine()) { | |
String line = scanner.nextLine(); | |
String[] parts = line.split(","); | |
String name = parts[0]; | |
int age = Integer.valueOf(parts[1]); | |
System.out.println("Name: " + name); | |
System.out.println("Age: " + age); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment