title: How to Print a square with asterisks in java with while loop only?
body: <p>I would like to know how to print a square with asterisks in java with a <code>while</code> loop only 
  but with out <code>for</code> loop and with out any logic operations like: <strong>AND</strong> or <strong>OR</strong></p>
  
  <p>This code should do something like that: if we enter <code>4</code> it should print: </p>
  
  <pre><code>* * * *
  *     *
  *     *
  * * * * 
  </code></pre>
  
  <p>but it does some thing else, like that: </p>
  
  <pre><code>* **
  
  
  *  
  </code></pre>
  
  <hr>
  
  <pre><code>    Scanner input = new Scanner(System.in);
  
      int squareside ;
      System.out.print("Enter the side: ");
      squareside = input.nextInt();
  
      while ( squareside != -1 )
      {
          int xaxis = 0 ;
          while ( xaxis &lt; squareside )
          {
  
              if( xaxis == 0 ) {
                  System.out.print(" *") ;
              }
              else if( xaxis == squareside - 1){
                  System.out.print(" *") ;
              }
              else
                  System.out.print(" ") ;
  
              xaxis ++ ;
  
          }
          int yaxis = 0 ;
  
          while( yaxis &lt; squareside )
          {
              if( yaxis == 0 )
              { 
                  System.out.print(" *");
              }
              else if( yaxis == squareside - 1)
  
              {
                  System.out.print(" *");
              }
              else    
                  System.out.print(" ");  
  
              yaxis ++;
              System.out.println();
  
          }
  
          System.out.print("Enter the side: ");
          squareside = input.nextInt();
      }
  </code></pre>