/** * A class for printing a column of X's. */ public class ColOfX { public static void main(String[] argv) { /* * Get the number of columns from the command line argument. * Since the command line argument is a String, convert it to * an int using Integer.parseInt. */ int numCols = Integer.parseInt(argv[0]); /* * In a loop to repeat for the desired number of columns, print out * an X with a newline. We use System.out.println to print with newline. */ for (int i = 1; i <= numCols; i++) { System.out.println("X"); } } }