GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing raw.githubusercontent.com — raw.githubusercontent.com /**
*
* 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 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. |