Why does the program ouput correct if dimensions create a square but not a rectangle?
<p>I'm writing a program where I need to make a hollow box of asterixs'. The program works fine when I enter dimensions for a square but it doesn't work when I enter dimensions for a rectangle.</p>

<pre><code>import java.util.Scanner;
public class asterix {
    public static void main(String[] args) { 

    Scanner input = new Scanner( System.in );

 int stars; // length of side
 int column; // width of box
 int row = 1;

// prompt user to enter the length and width of box

 System.out.print("Enter the length: ");
 stars = input.nextInt();

 System.out.print("Enter the width: ");
 column = input.nextInt();



 while ( row &lt;= stars ) {
     column = 1;

 // and for as many columns as rows 
while ( column &lt;= stars ) {

    if ( row == 1)
    System.out.print( "*" );

    else if ( row == stars )
    System.out.print( "*" );

    else if ( column == 1 )
    System.out.print( "*" );

    else if ( column == stars )
    System.out.print( "*" );

    else
    System.out.print( " " );

column++; } // end inner while loop

System.out.println();
 row++;


      } // end output
    } // end of main
} // end of Stars
</code></pre>

<p>The ideal output I would want is as follows:</p>

<p>Say its 3 by 3:</p>

<pre>
   ***
   * *
   ***
</pre>

<p>and say its 4 by 3:</p>

<pre>
   ****
   *  * 
   ****
</pre>
