1z0-819 Practice Test

1z0-819 Practice Test practice questions, page 9 of 9, with answer review and explanations.

Question 41

Given the code fragment: public void foo(Function fun) {...} Which two compile? (Choose two.)

  1. foo( n -> Integer.toHexString(n) )
  2. foo( toHexString )
  3. foo( n -> n + 1 )
  4. foo( int n -> Integer.toHexString(n) )
  5. foo( n -> Integer::toHexString )
  6. foo( Integer::toHexString )
  7. foo( n::toHexString )
  8. foo( (int n) -> Integer.toHexString(n) )

Question 42

Which declaration of an annotation type is legal?

  1. @interface Author { String name() default “”; String date(); }
  2. @interface Author extends Serializable { String name() default “”; String date(); }
  3. @interface Author { String name() default null; String date(); }
  4. @interface Author { String name(); String date; }
  5. @interface Author { String name(); String date default “”; }