Java program to find area of circle using bufferedreader

Let’s learn java program to find area of circle using bufferedreader.

Java program to find area of circle using bufferedreader

We can also calculate area of circle using BufferedReader class. BufferedReader class reads text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines. Here’s the java program.

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class UsingBufferedReader
{
   public static void main(String[] args) throws NumberFormatException, IOException
   {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      System.out.print("Please enter radius of circle: ");
      double radius = Double.parseDouble(br.readLine());
      double area = Math.PI * radius * radius;
      System.out.println("Area of circle using bufferedreader: " + area);
   }
}


Output:

Please enter radius of circle: 6
Area of circle using bufferedreader: 113.09733552923255


Also read – major features of java