コード例 #1
0
ファイル: Demo.java プロジェクト: alvenplay/BoP
  public static void main(String[] args) {
    // Figure f = new Figure(10, 10);
    Rectangle r = new Rectangle(9, 5);
    Triangle t = new Triangle(10, 8);

    System.out.println("Pole: " + r.area());
    System.out.println("Pole: " + t.area());
  }
コード例 #2
0
  @Test
  public void sixFor2x3Rectangle() throws Exception {
    Rectangle rectangle = new Rectangle();
    rectangle.setHeight(2);
    rectangle.setWidth(3);

    assertEquals(6, rectangle.area());
  }
コード例 #3
0
ファイル: testVariables.java プロジェクト: bajal/corejava1
  public static void main(String arags[]) {
    //        Rectangle myRect;
    //        myRect = new Rectangle();
    //        myRect.width = 40;
    //        myRect.height = 50;

    Rectangle myRect = new Rectangle(40, 50);
    System.out.println("myRect's area is " + myRect.area());
  }