Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package GUI;
- import java.io.File;
- import java.io.FileNotFoundException;
- import java.util.Scanner;
- public class FileReaderDemo {
- public static void main(String[] args) {
- FileReader fr = new FileReader("FileReaderDemo.java");
- try {
- File file = new File("C:/Users/grohale1/Test.txt");
- Scanner scan = new Scanner(file);
- String strZeile="";
- while ( scan.hasNextLine() ) {
- strZeile = scan.nextLine();
- System.out.println("Eingelesen: " + strZeile);
- }
- }
- catch (FileNotFoundException e) {
- System.out.println("Datei existiert nicht!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement