Question 121

Given:

Your design requires that:
* fuelLevel of Engine must be greater than zero when the start() method is invoked.
* The code must terminate if fuelLevel of Engine is less than or equal to zero.
Which code fragment should be added at line n1 to express this invariant condition?
  • Question 122

    Given the content of the employee.txtfile:
    Every worker is a master.
    Given that the employee.txtfile is accessible and the file allemp.txtdoes NOT exist, and the code fragment:

    What is the result?
  • Question 123

    Given:

    What is the result?
  • Question 124

    Which three statements describe the object-oriented features of the Java language?
  • Question 125

    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?