Reading Console using BufferedReader Java
In this tutorial, I am going to share simple program about Reading Console using BufferedReader Java. The example program has been tested and output shared in the same post.
BufferedReaderExample.java
package com.dineshkrish.files; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class BufferedReaderExample { public static void main(String[] args) throws IOException { // Defining the BufferedReader Object to read console data BufferedReader consoleReader = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter the value :"); try { // Invoking the readLine() method to read data String data = consoleReader.readLine(); System.out.println("Read from Console : "+data); } catch (IOException e) { System.out.println(e.getMessage()); e.printStackTrace(); } finally { consoleReader.close(); } } }
Output
—————-
Enter the value :Hello world
Read from Console : Hello world
More from my site

Hello, folks, I am a founder of idineshkrishnan.com. I love open source technologies, If you find my tutorials are useful, please consider making donations to these charities.
No responses yet