package recursion; public class Triangle { /* [] [][] [][][] [][][][] */ // triangle above has width = 4 private int width; public Triangle(int aWidth) { width = aWidth; } public int getArea() { // base case if (width == 1) return 1; Triangle smallerTriangle = new Triangle(width-1); int smallerArea = smallerTriangle.getArea(); return width + smallerArea; } public static void main(String[] args) { Triangle tri = new Triangle(100); int area = tri.getArea(); System.out.println("area: " + area); } }