Question 1
java.lang.IO is the console API used by compact source files (and available everywhere). Which two of the following are valid calls that compile against the Java 25 IO class? (Choose two.)
A. IO.println();Correct answer
Correct: matches the no-arg
println()overload, which prints just a line separator.B. IO.printf("%d%n", count);
There is no
printfonIO; formatted output still goes throughSystem.out.printforString.format. This is the single most commonIOtrap.C. IO.readln("Enter name: ");Correct answer
Correct: matches
readln(String), which prints the prompt and returns the line the user types.D. IO.print();
printexists only asprint(Object); there is no no-argprint(). Note the asymmetry:printlnhas a no-arg form,printdoes not.
Explanation
The Java 25 java.lang.IO API is deliberately tiny — its whole surface is println(Object), a no-arg println(), print(Object), readln(), and readln(String). A call compiles only when it matches one of those five overloads; a call to a method that does not exist, such as printf or a no-arg print, does not. IO has no printf and no format, so formatted output must still go through System.out.printf or String.format.