Oracle 1Z0-809
Get real exam questions for 1Z0-809 Java SE 8 Programmer II. 100% Free.
1Z0-809 Premium VCE File
Learn More
100% Pass Guarantee - Dumps Verified - Instant Download
150 Lectures, 20 Hours
Q1. Given: What is the result? A. Initialized Started B. Initialized Started Initialized C. Compilation fails D. An exception is thrown at runtime View AnswerAnswer: B Q2. Given: public class SampleClass { public static void main(String[] args) { AnotherSampleClass asc = new AnotherSampleClass(); SampleClass sc = new SampleClass(); sc = asc; System.out.println("sc: " + sc.getClass()
Q1. Given the definition of the Vehicle class: Class Vehhicle { int distance;//line n1 Vehicle (int x) { this distance = x; } public void increSpeed(int time) {//line n2 int timeTravel = time;//line n3 class Car { int value = 0; public void speed () { value = distance /timeTravel; System.out.println (“Velocity with new speed”+value+”kmph”); } } new Car().speed(); } } and
Q1. Which action can be used to load a database driver by using JDBC3.0? A. Add the driver class to the META-INF/services folder of the JAR file. B. Include the JDBC driver class in a jdbc.properties file. C. Use the java.lang.Class.forName method to load the driver class. D. Use the DriverManager.getDriver method to load the driver class. View AnswerAnswer: D Q2. The protected modifier o
Q1. Given: public class product { int id; int price; public Product (int id, int price) { this.id = id; this.price = price; } public String toString() { return id + “:” + price; } } and the code fragment: List<Product> products = Arrays.asList(new Product(1, 10), new Product (2, 30), new Product (2, 30)); Product p = products.stream().reduce(new Product (4, 0), (p1, p2) ->
Q1. Given the code fragments: interface CourseFilter extends Predicate<String> { public default boolean test (String str) { return str.equals (“Java”); } } and List<String> strs = Arrays.asList(“Java”, “Java EE”, “Java ME”); Predicate<String> cf1 = s - > s.length() > 3; Predicate cf2 = new CourseFilter() { //line n1 public boolean test (String s)
Q1. Given the code fragment: List<String> listVal = Arrays.asList(“Joe”, “Paul”, “Alice”, “Tom”); System.out.println ( // line n1 ); Which code fragment, when inserted at line n1, enables the code to print the count of string elements whose length is greater than three? A. listVal.stream().filter(x -> x.length()>3).count() B. listVal.stream().map(x -> x.lengt
Q1. Given the code fragment: List<String> codes = Arrays.asList (“DOC”, “MPEG”, “JPEG”); codes.forEach (c -> System.out.print(c + “ “)); String fmt = codes.stream() .filter (s-> s.contains (“PEG”)) .reduce((s, t) -> s + t).get(); System.out.println(“\n” + fmt); What is the result? A. DOC MPEG JPEG MPEGJPEG B. DOC MPEG MPEGJPEG MPEGMPEGJPEG C. MPEGJ
Q1. public class ForTest { public static void main(String[] args) { int[] arrar = {1,2,3}; for ( foo ) { } } } Which three are valid replacements for foo so that the program will compiled and run? A. int i: array B. int i = 0; i < 1; i++ C. ;; D. ; i < 1; i++ E. ; i < 1; View AnswerAnswer: A,B,C Q2. Given: class Book { int id; String name; public Book (int id, String n
Q1. Given the code fragment: List<String> nL = Arrays.asList(“Jim”, “John”, “Jeff”); Function<String, String> funVal = s -> “Hello : “.contact(s); nL.Stream() .map(funVal) .peek(System.out::print); What is the result? A. Hello : Jim Hello : John Hello : Jeff B. Jim John Jeff C. The program prints nothing. D. A compilation error occurs. View AnswerAnswer:
Q1. 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&l
Q1. Given: public interface Moveable<Integer> { public default void walk (Integer distance) {System.out.println(“Walking”);) public void run(Integer distance); } Which statement is true? A. Moveable can be used as below: Moveable<Integer> animal = n - > System.out.println(“Running” + n); animal.run(100); animal.walk(20); B. Moveable can be used as below: Moveable