title: For loop inside for loops java
body: <p>I am trying to get a for loop inside a for loop so that the output is like this:</p>
  
  <p>I wan the output to show a square</p>
  
  <p>I'm not sure why it isn't doing it.
  Below is my code:</p>
  
  <pre><code>import java.util.*;
  public class test {
  
      public static void main(String[] args) {
          System.out.println("Give me a number : ");
          Scanner kb = new Scanner(System.in);
          int i = kb.nextInt();
          for(int i2=i;i2&lt;i+i;i2++) {
              System.out.print("x");
              for( i2=i;i2&lt;i+i;i2++) {
                  System.out.println("x");    
              }
          }
      }
  }
  </code></pre>