Question 76

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?
10123 Ford
  • Question 77

    In 2015, daylight saving time in New York, USA, begins on March 8th at 2:00 AM. As a result, 2:00 AM becomes 3:00 AM.
    Given the code fragment:

    Which is the result?
  • Question 78

    Given the code fragment:
    public class Foo {
    public static void main (String [ ] args) {
    Map<Integer, String> unsortMap = new HashMap< > ( );
    unsortMap.put (10, "z");
    unsortMap.put (5, "b");
    unsortMap.put (1, "d");
    unsortMap.put (7, "e");
    unsortMap.put (50, "j");
    Map<Integer, String> treeMap = new TreeMap <Integer, String> (new
    Comparator<Integer> ( ) {
    @Override public int compare (Integer o1, Integer o2) {return o2.compareTo
    (o1); } } );
    treeMap.putAll (unsortMap);
    for (Map.Entry<Integer, String> entry : treeMap.entrySet () ) {
    System.out.print (entry.getValue () + " ");
    }
    }
    }
    What is the result?
  • Question 79

    Given the code fragment:

    Which code fragment, when inserted at line n1, enables the code to print /First.txt?
  • Question 80

    For which three objects must a vendor provide implementations in its JDBC driver? (Choose three.)