Here is the code the 5th period class wrote:
/*
//read int and print that many Xs on a line
Scanner input = new Scanner(System.in);
int numX = input.nextInt();
for(int i=0; i < numX; i++) {
System.out.print("X");
}
System.out.println();
*/
/*
//alternate:
for(int i=input.nextInt(); i > 0; i--) {
System.out.print("X");
}
System.out.println();
*/
/*
//read 2 ints and print rectange of those dimensions
Scanner input = new Scanner(System.in);
int numCols = input.nextInt();
int numRows = input.nextInt();
for(int j=0; j < numRows; j++) {
for(int i=0; i < numCols; i++) {
System.out.print("X");
}
System.out.println();
}
*/
//read 2 ints and print hollow rectange of those dimensions
Scanner input = new Scanner(System.in);
int numCols = input.nextInt();
int numRows = input.nextInt();
for(int j=0; j < numRows; j++) {
for(int i=0; i < numCols; i++) {
if(i == 0 || i == numCols-1 || j == 0 || j == numRows-1) {
System.out.print("X");
} else {
System.out.print(" ");
}
}
System.out.println();
}