07:31Java FileReader (read a file) 📖
From the creator
Java FileReader how to read a file tutorial example #Java #FileReader #read #file #tutorial #example public class Main { public static void main(String[] args) { // FileReader = read the contents of a file as a stream of characters. //read() returns an int value which contains the byte value //when read() returns -1, there is no more data to be read try { FileReader reader = new FileReader("art.txt"); int data = reader.read(); while(data != -1) { System.out.print((char)data); data = reader.read(); } reader.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
Published 2020-10-06 · Watch on YouTube ↗
Availability and playback restrictions are controlled by the original channel.





