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 — JavaTutorial/src/21_ClassObjects.java at master · faikturan/JavaTutorial

Expand file tree

/

21_ClassObjects.java

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
60 lines (43 loc) · 924 Bytes
/

21_ClassObjects.java

Copy path

File metadata and controls

60 lines (43 loc) · 924 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
*
* Class, Objects, Instance and Field Variable
* */
public class Main {
public static void main(String[] args) {
Rectangle r1 = new Rectangle();
r1.setLength(10);
r1.setBreadth(20);
Rectangle r2 = r1;
r2.setLength(50);
r2.setBreadth(100);
Rectangle r3 = new Rectangle();
Rectangle r4 = new Rectangle();
Rectangle r5 = new Rectangle();
System.out.println(r1.getBreadth());
System.out.println(r1.getLength());
}
}
public class Rectangle {
int length; // or it can be float
int breadth;
public float getArea() {
float area = length * breadth;
return area;
}
public float findPerimeter() {
int p = 2 * ( length + breadth );
return p;
}
public int getLength() {
return length;
}
public void setLength(int length) {
this.length = length;
}
public int getBreadth() {
return breadth;
}
public void setBreadth(int breadth) {
this.breadth = breadth;
}
}
You are visitor 01402503 — 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.