title: Java - print X^X^X squares
body: <p>I got a task to do, my task is to print X amount of squares of X^X. for example the correct output for input &quot;3&quot; is the following picture</p>
  <p>Example here:<br />
  <a href="https://i.stack.imgur.com/bSMsA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bSMsA.png" alt="image" /></a></p>
  <p>My code:</p>
  <pre class="lang-java prettyprint-override"><code>Scanner s = new Scanner (System.in);
  int base, k=0;
  System.out.println(&quot;Enter a number do draw some squares&quot;);
  base = s.nextInt();
  int bb = base*base;
  
  for (int t=0; t&lt;=bb; t++) {
      if (t&lt;bb) {
          for (int i=0; i&lt;base; i++) {
              for (k=0; k&lt;=base; k++) {
                  if (k&lt;base) 
                      System.out.print(&quot;*&quot;);
                  else
                      System.out.print(&quot; &quot;);
              }
          }
      }
      System.out.println();
  }
  </code></pre>
  <p>When trying to use '2' as the base the output is:</p>
  <pre class="lang-none prettyprint-override"><code>** ** 
  ** ** 
  ** ** 
  ** ** 
  </code></pre>
  <p>My output:<br />
  <a href="https://i.stack.imgur.com/LPwGI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LPwGI.png" alt="image" /></a></p>
  <p>How I can do the spaces between every 2 lines?</p>
  <p>Sincerely,</p>