Answer:
class Main {
public static void main(String[] args) {
makeATree();
}
private static int TREESIZE = 9;
public static void makeATree() {
String gap = "";
for (int row = TREESIZE; row > 0; row--) {
System.out.print(gap);
gap += " ";
for(int col = 0; col < row; col++) {
System.out.printf("* ");
}
System.out.printf("\\");
}
}
}
Step-by-step explanation:
Here you go. The tree size is a magic number, so I isolated that into a static class variable.