1z0-809 Exam Question 136

Given: What is the result?
  • 1z0-809 Exam Question 137

    Given the code fragments:
    class Employee {
    Optional<Address> address;
    Employee (Optional<Address> address) {
    this.address = address;
    }
    public Optional<Address> getAddress() { return address; }
    }
    class Address {
    String city = "New York";
    public String getCity { return city: }
    public String toString() {
    return city;
    }
    }
    and
    Address address = null;
    Optional<Address> addrs1 = Optional.ofNullable (address);
    Employee e1 = new Employee (addrs1);
    String eAddress = (addrs1.isPresent()) ? addrs1.get().getCity() : "City Not available"; What is the result?
  • 1z0-809 Exam Question 138

    Given the code fragment:

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

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

    Given:
    Book.java:
    public class Book {
    private String read(String bname) { return "Read" + bname }
    }
    EBook.java:
    public class EBook extends Book {
    public class String read (String url) { return "View" + url }
    }
    Test.java:
    public class Test {
    public static void main (String[] args) {
    Book b1 = new Book();
    b1.read("Java Programing");
    Book b2 = new EBook();
    b2.read("http://ebook.com/ebook");
    }
    }
    What is the result?