Think of recursive calls in terms of a stack. A stack is a data structure which adds to the top of a pile. A real world analogy is a pile of dishes where the newest dish goes on the top. Therefore recursive calls add another layer to the top of the stack, then once some criteria is met which prevents further recursive calls, the stack starts to unwind and we work our way back down to the original item (the first plate in pile of dishes).
The input of a recursive method tends towards a base case which is the termination factor and prevents the method from calling itself indefinitely (infinite loop). Once this base condition is met the method returns a value rather than calling itself again. This is how the stack in unwound.
In your method, the base case is when $n<1$ and the recursive calls use the input $n-1$. This means the method will call itself, each time decreasing $n$ by 1, until $n<1$ i.e. $n=0$. Once the base condition is met, the value 0 is returned and we start to execute the $for$ loop. This is why the first line contains a single asterix.
So if you run the method with an input of 5, the recursive calls build a stack of values of $n$ as so
0
1
2
3
4
5
Then this stack is unwound starting with the top, 0, all the way down to 5.
System.out.print("*");occurred beforeAsterisk(n-1);, the output would be what you are expecting.Asterisk(n)=>Asterisk(n-1)=> ... =>Asterisk(0)=> print statements ofAsterisk(1)followed by print statements ofAsterisk(2)followed by ... followed by print statements ofAsterisk(n). Basically:Asterisk(Asterisk(Asterisk(...Asterisk(1)...))), where you havennested methods. If you know mathematics, you know that you start withAsterisk(1)and work your way out.