Print a christmas tree
I have some suggestions for your code.

Most of your loops can be replaced with java.lang.String#repeat (Java 11+)

Example
&quot;*&quot;.repeat(10) // Will give you &quot;**********&quot;


I suggest that you create a class constant for each of the tree's parts (*, \n, |) to allow the code to be easier to refactor / make changes in the future, if you need to (i.e., change the star by a plus sign, etc.).

For the tree's parts, I suggest that you use character instead of string, since the character will take less memory than the string (very small amount in this case, but still).
&quot; &quot; -&gt; ' '