1z0-819 Practice Test

1z0-819 Practice Test practice questions, page 5 of 9, with answer review and explanations.

Question 21

A company has an existing Java 8 jar file, sales-app-1.1.1.jar, that uses several Apache open source jar files that have not been modularized. Which module-info.java file should be used to convert sales-app-1.1.jar to a module?

  1. module com.company.sales_app { requires commons.beanutils; requires org.apache.commons.collections4; requires org.apache.commons.lang3; requires org.apache.commons.text; }
  2. module com.company.sales_app { requires org.apache.commons.beanutils; requires org.apache.commons.collections4; requires org.apache.commons.lang3; requires org.apache.commons.text; }
  3. module com.company.sales_app { requires commons.beanutils; requires commons.collections4; requires commons.lang3; requires commons.text; }
  4. module com.company.sales_app { requires commons.beanutils-1.9.3; requires commons.collections4-4.2; requires commons.lang3-3.8.1; requires commons.text-1.3; }

Question 22

Which two are valid statements? (Choose two.)

  1. BiPredicate<Integer, Integer> test = (final Integer x, var y) -> (x.equals(y));
  2. BiPredicate<Integer, Integer> test = (var x, final var y) -> (x.equals(y));
  3. BiPredicate<Integer, Integer> test = (Integer x, final var y) -> (x.equals(y));
  4. BiPredicate<Integer, Integer> test = (final var x, y) -> (x.equals(y));
  5. BiPredicate<Integer, Integer> test = (Integer x, final Integer y) -> (x.equals(y));

Question 23

Given: and What is the result?

  1. Mr. Green
  2. Green
  3. An exception is thrown at runtime.
  4. Mr. Blue

Question 24

Given: It is required that if p instanceof Pair then p.isValid() returns true. Which is the smallest set of visibility changes to insure this requirement is met?

  1. left, right, setLeft, and setRight must be private.
  2. setLeft and setRight must be protected.
  3. left and right must be private.
  4. isValid must be public.

Question 25

You want to read data through the reader object. Which statement inserted on line 1 will accomplish this?

  1. characters = reader.read();
  2. reader.readLine();
  3. characters.read();
  4. reader.read(characters);