Question 121

Given the code format:

Which code fragment must be inserted at line 6 to enable the code to compile?
  • Question 122

    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?
  • Question 123

    Given the code fragment:

    Which code fragment, when inserted at line 7, enables printing 100?
    Function<Integer> funRef = e -> e + 10;
  • Question 124

    Given the code fragment:
    List<Integer> codes = Arrays.asList (10, 20);
    UnaryOperator<Double> uo = s -> s +10.0;
    codes.replaceAll(uo);
    codes.forEach(c -> System.out.println(c));
    What is the result?
  • Question 125

    Given the code fragment:

    What is the result?