Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package bleh;
- import java.io.File; // IMPORTERE FILE
- import java.io.FileNotFoundException;
- import java.util.Scanner; // IMPORTERE SCANNER
- public class readFile {
- public static void main(String[] args) {
- readFile("scoresheet.txt");
- }
- public static void readFile(String filename){
- File inputFile = new File(filename);
- String buffer = "";
- try {
- Scanner readFile = new Scanner(inputFile);
- while(readFile.hasNext()){
- buffer = readFile.nextLine();
- System.out.println(buffer);
- }
- } catch (FileNotFoundException e) {
- System.out.println("Cant find file.");
- }
- System.out.println("Test.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement