Menu

read from file Archive

How to read a file in Java?

There are many ways to read a file in Java. The simplest and most common used method is using BufferedReader class. First of all, let’s create a file and name it as “example.txt” with some dummy text: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec arcu nibh, maximus porttitor diam eu, dapibus vestibulum nulla.