Site Search:

OCPJP Simulation Test 101

<Back to OCPJP





Question: What is the output of the following code?

  1 import java.util.function.*;
  2 public class Printing {
  3   public static void main(String...args) {
  4     Supplier<String> s1 = String::new;
  5     System.out.print(s1.get());
  6     Supplier<int> s2 = Integer::new;
  7     System.out.print(s2.get());}}


Choice:
A. no output
B. empty space followed by 0
C. 0
D. null0
E. nullnull
F. s1s2
G. code does not compile
H. code compiles but throw runtime exceptions.