title: Java Beginner - How to print a character multiple time on one line
body: <p>I am trying to code a program to print a box of * when a value is entered.
  e.g if a user enters 5 the system will print out 5 line of a star (*) printed 5 times on each line.</p>
  
  <p>I've currently got the system to print out the correct amount of lines, but not the correct amount of '*' on the line.</p>
  
  <p>How can I get the system to print '*' the amount of times the user entered, on one line?</p>
  
  <p>my current code:</p>
  
  <pre><code>import java.util.Scanner;
  public class Main
  {
      public static void main(String args[])
      {
          Scanner in = new Scanner(System.in);
  
          int size;
          int line = 1;
  
         System.out.print(" #Enter size of square:   ");
         size = in.nextInt();
  
         while (line &lt;= size)
         {
              System.out.println("*");
              line = line + 1;
          }
      }
  }
  </code></pre>