Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) throws Exception {
- 06
- // Create a File instance
- 07
- java.io.File file = new java.io.File("scores.txt");
- 08
- 09
- // Create a Scanner for the file
- 10
- Scanner input = new Scanner(file);
- 11
- 12
- // Create the Content String
- 13
- String fileContent = "";
- 14
- 15
- // Read data from a file
- 16
- while (input.hasNext()) {
- 17
- fileContent += input.next() + " ";
- 18
- }
- 19
- // Close the file
- 20
- input.close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement