1z0-809 Exam Question 76

Given the code fragment:
Path file = Paths.get ("courses.txt");
// line n1
Assume the courses.txtis accessible.
Which code fragment can be inserted at line n1to enable the code to print the content of the courses.txt file?
List<String> fc = Files.list(file);
  • 1z0-809 Exam Question 77

    Given:

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

    Given the code fragments :

    and

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

    Given:
    class ImageScanner implements AutoCloseable {
    public void close () throws Exception {
    System.out.print ("Scanner closed.");
    }
    public void scanImage () throws Exception {
    System.out.print ("Scan.");
    throw new Exception("Unable to scan.");
    }
    }
    class ImagePrinter implements AutoCloseable {
    public void close () throws Exception {
    System.out.print ("Printer closed.");
    }
    public void printImage () {System.out.print("Print."); }
    }
    and this code fragment:
    try (ImageScanner ir = new ImageScanner();
    ImagePrinter iw = new ImagePrinter()) {
    ir.scanImage();
    iw.printImage();
    } catch (Exception e) {
    System.out.print(e.getMessage());
    }
    What is the result?
  • 1z0-809 Exam Question 80

    Given:
    public class Test<T> {
    private T t;
    public T get () {
    return t;
    }
    public void set (T t) {
    this.t = t;
    }
    public static void main (String args [ ] ) {
    Test<String> type = new Test<>();
    Test type 1 = new Test ();//line n1
    type.set("Java");
    type1.set(100);//line n2
    System.out.print(type.get() + " " + type1.get());
    }
    }
    What is the result?