Oracle 1Z0-808 Exam question no. 45

Q.- Given the code fragment:-

7.   public static void main ( String [ ] args)  {
8.   Predicate<Integer> p= ( n ) -->  n%2 = = 0;
9.   // insert code here
10. }

Which code snippet at line 9 prints true?

A) System.out.println(p.apply(1000));

B)  Boolean s = p.test(500);
     System.out.println(s);

C) Integer s = p.test(100);
     if(s = =1) {
           System.out.println("false");
     }
     else {
          System.out.println("false");
    }

D) Boolean s = p.apply(100);
     System.out.println(s);


⧪ please give your answer in a comment section.

Post a Comment

3 Comments