public static String printLine(String a,int num){
  StringBuilder builder=new StringBuilder();
  for (int i=0; i < num; i++) {
    builder.append(a);
  }
  return builder.toString();
}

public static String printLine ( String a , int num ) { StringBuilder builder = new StringBuilder ( ) ; for ( int i = 0 ; i < num ; i ++ ) { builder . append ( a ) ; } return builder . toString ( ) ; }
below method will create string like " * * * * * * * * * * * "
