GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Java/Programs/areaRect.java at main · arshcoder13/Java

Expand file tree

/

areaRect.java

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
28 lines (28 loc) · 644 Bytes
/

areaRect.java

Copy path

File metadata and controls

28 lines (28 loc) · 644 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Program to calculate the area of rectangle using return values -
package area;
class Rectangle {
public int l, b;
public void getData(int m, int n) {
l = m;
b = n;
}
public int calcArea() {
int area = l * b;
return area;
}
}
public class AreaRect {
public static void main(String[] args) {
// TODO Auto-generated method stub
int a1, a2;
Rectangle r1 = new Rectangle();
Rectangle r2 = new Rectangle();
r1.l = 10;
r1.b = 15;
a1 = r1.l * r1.b;
r2.getData(20, 30);
a2 = r2.calcArea();
System.out.println("The area of first rectangle = " + a1);
System.out.println("The area of second rectangle = " + a2);
}
}
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.