Answers for "area of a rectangle"

1

Calculate area of rectangle using default constructor in java

import java.util.*;
class RectangleShape 
{
   int area, length, breadth; 
   RectangleShape() 
   { 
      length = 50; 
      breadth = 20; 
   } 
   void getArea() 
   { 
      area = length * breadth; 
      System.out.println("Area of Rectangle : " + area); 
   }  
}
public class RectangleAreaConstructor
{
   public static void main(String[] args) 
   {
      RectangleShape rs = new RectangleShape(); 
      rs.getArea();
   }
}
Posted by: Guest on February-09-2021
3

Java program to calculate area of rectangle

import java.util.Scanner;
public class RectangleArea
{
   public static void main(String[] args)
   {
      Scanner sc = new Scanner(System.in);
      System.out.println("Please enter length of rectangle: ");
      double length = sc.nextDouble();
      System.out.println("Please enter width of rectangle: ");
      double width = sc.nextDouble();
      double area = length * width;
      System.out.println("Area of rectangle is: " + area);
      sc.close();
   }
}
Posted by: Guest on November-10-2020
3

formula to find area of a rectangle

formula:
Lenght * Width
Posted by: Guest on October-08-2021
8

area of square

Area of square = Length (or width, whichever) to the power of 2
Posted by: Guest on September-17-2020

Code answers related to "area of a rectangle"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language