Review Questions


1. What is the output?
for(int i = 1; i <= 4; i++) {
    for(int j = 1; j <= 4; j++) {
        System.out.print(i);
    }
    System.out.println();
}

A.                B.
1111            1234
2222            1234
3333            1234
4444            1234

C.
1234123412341234

D.
1111222233334444


Fill in the blanks.

public static void main(String[] args) {
    // print a line of 10 asterisks
    printLine(__<*1>__);
}

public static void printLine(__<*2>__) {
    for(int i = 1; i <= count; i++) {
        System.out.print("*");
    }
    System.out.println();
}

For blank <*1>:               For blank <*2>:

A. 10                                 A. 10

B. int 10                            B. int 10

C. int count                       C. int count