Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package harr4603_lab02;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- /**
- * Reads source file
- * @author Jordan Harris
- * @version 1.0
- *
- */
- public class readSource {
- public static void main(String[] args) throws FileNotFoundException
- {
- File file = new File("src/harr4603_lab02/ScannerTest.java");
- Scanner source = new Scanner(file);
- int lines = 0;
- while(source.hasNextLine())
- {
- System.out.println(source.nextLine());
- lines++;
- }
- System.out.println("This source file has: " + lines + " lines.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement