Java Programming Exercise : Use for loop to print start (*)

Exercise: Using for loop to print star as below:
*
*  *
*  *  *
*  * *  *
Let's do and compare with my solution below:

public class StarPrint {

 /**
  * YaSolution.org
  */
 public static void main(String[] args) {
  // TODO Auto-generated method stub
  for(int i=0;i<5;i++){
   for(int k=0;k<i;k++){
    System.out.print("* ");
   }
   System.out.println();
  }
 }

}
Comment below if you see my code has error.