Computer Science 121
Example to illustrate nested for loops.

import java.io.*;

public class Boxes
{
    public static void main (String [] args)
    {
        Box box = new Box ();
        box.readData ();
        box.displayBox ();
    } // main method
} // class Boxes

class Box
{
    private int width, height;

    public void readData ()
    {
        try
        {
            BufferedReader stdin = new BufferedReader (new InputStreamReader (System.in));
            System.out.print ("Width: ");
            width = Integer.parseInt (stdin.readLine ());
            System.out.print ("Height: ");
            height = Integer.parseInt (stdin.readLine ());
        }
        catch (IOException e) { System.out.println ("I/O error");}
        catch (NumberFormatException ex) { System.out.println ("Number format error.");}
    } // method readData

    public void displayBox ()
    {
        for (int row = 0; row < height; row ++)
        {
            for (int col = 0; col < width; col++)
                System.out.print ("* ");
            System.out.println ("*");
        }
    } // method displayBox
} // class Box