1z0-809 Exam Question 136

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?
  • 1z0-809 Exam Question 137

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

    What is the result?
  • 1z0-809 Exam Question 138

    Which two statements are true about localizing an application? (Choose two.)
  • 1z0-809 Exam Question 139

    Given:
    class FuelNotAvailException extends Exception { }
    class Vehicle {
    void ride() throws FuelNotAvailException {//line n1
    System.out.println("Happy Journey!");
    }
    }
    class SolarVehicle extends Vehicle {
    public void ride () throws Exception {//line n2
    super ride ();
    }
    }
    and the code fragment:
    public static void main (String[] args) throws FuelNotAvailException, Exception {
    Vehicle v = new SolarVehicle ();
    v.ride();
    }
    Which modification enables the code fragment to print Happy Journey!?
  • 1z0-809 Exam Question 140

    Given the code fragments:
    class MyThread implements Runnable {
    private static AtomicInteger count = new AtomicInteger (0);
    public void run () {
    int x = count.incrementAndGet();
    System.out.print (x+" ");
    }
    }
    and
    Thread thread1 = new Thread(new MyThread());
    Thread thread2 = new Thread(new MyThread());
    Thread thread3 = new Thread(new MyThread());
    Thread [] ta = {thread1, thread2, thread3};
    for (int x= 0; x < 3; x++) {
    ta[x].start();
    }
    Which statement is true?