public class TestRectangle {
public static void main(String[] args) {
//Datas are created
Rectangle data1=new Rectangle(4,40);
Rectangle data2=new Rectangle(3.5,35.9);
//This calls to string method and implements data1 and data2
System.out.println(""+data1+data2);
//This area is not necessary because I created a new storage space.Methods implement datas.
double area=data1.getArea();
double area2=data2.getArea();
System.out.println(" First area is "+data1.getArea()+".Second area is "+data2.getArea());
//This perimeter is not necessary because I created a new storage space.Methods implement datas.
double perimeter=data1.getPerimeter();
double perimeter2=data2.getPerimeter();
System.out.println(" First perimeter is "+data1.getPerimeter()+" .Second perimeter is "+data2.getPerimeter());
}
}
Hiç yorum yok:
Yorum Gönder