Java Programming | Area of circle


This is a tutorial for area of circle in java programming. The program is given below that explains the program very well. The program is extendable. Go enjoy the program. Lets begin…..

Program for area of circle in java.

//import Scanner as we require it.
import java.util.Scanner;

// the name of our class its public
public class CircArea {
//void main
public static void main (String[] args)
//declare float
float area,r;
//print message
System.out.println(“Enter Radius:”);
//Take input
Scanner input = new Scanner(;
r = input.nextFloat();
area = 3.142f*r*r;
//print the area
System.out.println(“Area = “+area);


Enter Radius:
Area = 12.568

How it works

  1. The program prints the message to enter numbers.
  2. The user enters radius.
  3. Area is calculated.
  4. The area is printed.

Extending it

The program can be extended by taking more different shapes and calculating their area.


  1. Import the Scanner.
  2. Declare the class as public
  3. Add the void main function
  4. Add system.out.println() function with the message to enter radius.
  5. Declare input as Scanner.
  6. Take the radius and save it in variable.
  7. Calculate area and save it in other variable.
  8. Add system.out.println() function to print the area.

At the end.

You learnt creating the Java program for Area of circles. So now enjoy the program.

Please comment on the post and share it.
And like it if you liked.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s