
Chapter 2
Console Input and Output
ďŽâMultiple Choice
1) Valid arguments to the System.out objectâs println method include:
(a) âAnything with double quotesâ
(b) String variables
(c) Variables of type int
(d) All of the above
2) Which statement or group of statements produces the output: Java programming is fun!
(a) System.out.print(Java programming);
System.out.print(is fun!);
(b) System.out.println(Java programming is fun!);
(c) System.out.println(âJava programmingâ);
System.out.println(â is fun!â);
(d) System.out.print(âJava programmingâ)
System.out.println(â is fun!â);
2) If a hyphen is added after the % in a format specifier, the output will be _________.
(a) Left justified
(b) Right justified
(c) Centered
(d) None of the above
3) The statement: System.out.printf("%6.2f", 597.7231); displays:
(a) 597.723
(b) 597.72
(c) 000597.72
(d) None of the above