Question 41
Given the code fragment: public void foo(Function fun) {...} Which two compile? (Choose two.)
- foo( n -> Integer.toHexString(n) )
- foo( toHexString )
- foo( n -> n + 1 )
- foo( int n -> Integer.toHexString(n) )
- foo( n -> Integer::toHexString )
- foo( Integer::toHexString )
- foo( n::toHexString )
- foo( (int n) -> Integer.toHexString(n) )
Question 42
Which declaration of an annotation type is legal?
- @interface Author { String name() default “”; String date(); }
- @interface Author extends Serializable { String name() default “”; String date(); }
- @interface Author { String name() default null; String date(); }
- @interface Author { String name(); String date; }
- @interface Author { String name(); String date default “”; }