previous |
start |
next
Computing the area of a triangle with width 4
- getArea method
makes a smaller triangle of width 3
-
- It calls getArea
on that triangle
-
- That method makes a smaller triangle of width 2
-
- It calls getArea
on that triangle
-
- That method makes a smaller triangle of width 1
- It calls getArea
on that triangle
- That method returns 1
- The method returns smallerArea + width = 1 + 2 = 3
- The method returns smallerArea + width = 3 + 3 = 6
- The method returns smallerArea + width = 6 + 4 = 10
previous |
start |
next