MCPcopy Create free account
hub / github.com/PrajaktaSathe/Java / Area

Class Area

Programs/constructors.java:2–16  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1// Program to demonstrate the use of constructors in Java -
2class Area {
3 int length, breadth;
4 // Parameterized constructor
5 Area(int m, int n) {
6 length = m;
7 breadth = n;
8 }
9 // Function to calculate area of rectangle
10 void rectArea(Area a) {
11 System.out.println("Length = " + a.length); // Printing length
12 System.out.println("Breadth = " + a.breadth); // Printing breadth
13 int area = a.length * a.breadth; // Calculating area
14 System.out.println("Area of rectangle is: " + area); // Printing area
15 }
16}
17
18public class constructors {
19 public static void main(String[] args) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected