Question 81

Given:

What is the result?
  • Question 82

    Given:
    class Vehicle {
    int vno;
    String name;
    public Vehicle (int vno, String name) {
    this.vno = vno,;
    this.name = name;
    }
    public String toString () {
    return vno + ":" + name;
    }
    }
    and this code fragment:
    Set<Vehicle> vehicles = new TreeSet <> ();
    vehicles.add(new Vehicle (10123, "Ford"));
    vehicles.add(new Vehicle (10124, "BMW"));
    System.out.println(vehicles);
    What is the result?
  • Question 83

    Given:

    and

    Which interface from the java.util.functionpackage should you use to refactor the class Txt?
  • Question 84

    Given the code fragment:
    BiFunction<Integer, Double, Integer> val = (t1, t2) -> t1 + t2; //line n1
    System.out.println(val.apply(10, 10.5));
    What is the result?
  • Question 85

    Given the code fragment:

    You have been asked to define the ProductCode class. The definition of the ProductCode class must allow c1 instantiation to succeed and cause a compilation error on c2 instantiation.
    Which definition of ProductCode meets the requirement?