Question 16

Given the code fragments:

and

What is the result?
  • Question 17

    Given:

    and this code fragment:

    What is the result?
  • Question 18

    You have been asked to create a ResourceBundle which uses a properties file to localize an application.
    Which code example specifies valid keys of menu1 and menu2 with values of File Menu and View Menu?
  • Question 19

    Given the code fragments:
    interface CourseFilter extends Predicate<String> {
    public default boolean test (String str) {
    return str.equals ("Java");
    }
    }
    and
    List<String> strs = Arrays.asList("Java", "Java EE", "Java ME");
    Predicate<String> cf1 = s - > s.length() > 3;
    Predicate cf2 = new CourseFilter() { //line n1
    public boolean test (String s) {
    return s.contains ("Java");
    }
    };
    long c = strs.stream()
    .filter(cf1)
    .filter(cf2//line n2
    .count();
    System.out.println(c);
    What is the result?
  • Question 20

    Given:

    and the code fragment:

    Which definition of the ColorSorterclass sorts the blocks list?