Question 1

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 2

    Given:
    public interface Moveable<Integer> {
    public default void walk (Integer distance) {System.out.println("Walking");)
    public void run(Integer distance);
    }
    Which statement is true?
  • Question 3

    Given:
    class Vehicle implements Comparable<Vehicle>{
    int vno;
    String name;
    public Vehicle (int vno, String name) {
    this.vno = vno,;
    this.name = name;
    }
    public String toString () {
    return vno + ":" + name;
    }
    public int compareTo(Vehicle o) {
    return this.name.compareTo(o.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 4

    Given:
    class Student {
    String course, name, city;
    public Student (String name, String course, String city) {
    this.course = course; this.name = name; this.city = city;
    }
    public String toString() {
    return course + ":" + name + ":" + city;
    }
    and the code fragment:
    List<Student> stds = Arrays.asList(
    new Student ("Jessy", "Java ME", "Chicago"),
    new Student ("Helen", "Java EE", "Houston"),
    new Student ("Mark", "Java ME", "Chicago"));
    stds.stream()
    .collect(Collectors.groupingBy(Student::getCourse))
    .forEach(src, res) -> System.out.println(scr));
    What is the result?
  • Question 5

    Given the code fragment:

    What is the result?