Question 21

Given:

Which statement is true?
  • Question 22

    Given the code fragment:

    What is the result?
  • Question 23

    Assume customers.txt is accessible and contains multiple lines.
    Which code fragment prints the contents of the customers.txt file?
  • Question 24

    Given the code fragment:
    List<String> str = Arrays.asList ("my", "pen", "is", "your', "pen");
    Predicate<String> test = s -> {
    int i = 0;
    boolean result = s.contains ("pen");
    System.out.print(i++) + ":");
    return result;
    };
    str.stream()
    .filter(test)
    .findFirst()
    .ifPresent(System.out ::print);
    What is the result?
  • Question 25

    Given the code fragment:

    Assume that dbURL, userName, and passwordare valid.
    Which code fragment can be inserted at line n1to enable the code to print Connection Established?
    Properties prop = new Properties();