Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- import java.nio.BufferOverflowException;
- /**
- * Created by Anatoliy on 31.08.2016.
- * Pr 4.1
- */
- public class Pr4 {
- public static void main(String[] args) throws FileNotFoundException {
- String filename = "MyFile.txt";
- File file = new File(filename);
- try (FileReader reader = new FileReader(file))
- {
- char[] buffer = new char[(int)file.length()];
- reader.read(buffer);
- System.out.println(new String(buffer));
- }
- catch (IOException ex) {
- System.out.println(ex.getMessage());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement