27 January, 2022
Latest 1Z0-809 Preparation Labs For Java SE 8 Programmer II Certification
We provide real 1Z0-809 exam questions and answers braindumps in two formats. Download PDF & Practice Tests. Pass Oracle 1Z0-809 Exam quickly & easily. The 1Z0-809 PDF type is available for reading and printing. You can print more and practice many times. With the help of our Oracle 1Z0-809 dumps pdf and vce product and material, you can easily pass the 1Z0-809 exam.
Also have 1Z0-809 free dumps questions for you:
Question 1
Given:
What is the result?
What is the result?
Question 2
Given the code fragment:
What is the result?
What is the result?
Question 3
Which two reasons should you use interfaces instead of abstract classes? (Choose two.)
Question 4
Given the code fragment:
List nums = Arrays.asList (10, 20, 8): System.out.println (
//line n1
);
Which code fragment must be inserted at line n1 to enable the code to print the maximum number in the nums list?
List
//line n1
);
Which code fragment must be inserted at line n1 to enable the code to print the maximum number in the nums list?
Question 5
Given the code fragment:
public class FileThread implements Runnable { String fName;
public FileThread(String fName) { this.fName = fName; } public void run () System.out.println(fName);}
public static void main (String[] args) throws IOException, InterruptedException {
ExecutorService executor = Executors.newCachedThreadPool(); Stream listOfFiles = Files.walk(Paths.get(“Java Projects”)); listOfFiles.forEach(line -> {
executor.execute(new FileThread(line.getFileName().toString ())); //
line n1
});
executor.shutdown(); executor.awaitTermination(5, TimeUnit.DAYS); // line n2
}
}
The Java Projects directory exists and contains a list of files. What is the result?
public class FileThread implements Runnable { String fName;
public FileThread(String fName) { this.fName = fName; } public void run () System.out.println(fName);}
public static void main (String[] args) throws IOException, InterruptedException {
ExecutorService executor = Executors.newCachedThreadPool(); Stream
executor.execute(new FileThread(line.getFileName().toString ())); //
line n1
});
executor.shutdown(); executor.awaitTermination(5, TimeUnit.DAYS); // line n2
}
}
The Java Projects directory exists and contains a list of files. What is the result?
Question 6
Given the code fragment: UnaryOperator uo1 = s -> s*2; line n1
List loanValues = Arrays.asList(1000.0, 2000.0); loanValues.stream()
.filter(lv -> lv >= 1500)
.map(lv -> uo1.apply(lv))
.forEach(s -> System.out.print(s + “ “)); What is the result?
List
.filter(lv -> lv >= 1500)
.map(lv -> uo1.apply(lv))
.forEach(s -> System.out.print(s + “ “)); What is the result?
Question 7
Given:
final class Folder { //line n1
//line n2
public void open () { System.out.print(“Open”);
}
}
public class Test {
public static void main (String [] args) throws Exception { try (Folder f = new Folder()) {
final class Folder { //line n1
//line n2
public void open () { System.out.print(“Open”);
}
}
public class Test {
public static void main (String [] args) throws Exception { try (Folder f = new Folder()) {
Question 8
Given the code fragment: public class Foo {
public static void main (String [ ] args) {
Map unsortMap = new HashMap< > ( ); unsortMap.put (10, “z”);
unsortMap.put (5, “b”);
unsortMap.put (1, “d”);
unsortMap.put (7, “e”);
unsortMap.put (50, “j”);
Map treeMap = new TreeMap (new Comparator ( ) {
@Override public int compare (Integer o1, Integer o2) {return o2.compareTo
(o1); } } );
treeMap.putAll (unsortMap);
for (Map.Entry entry : treeMap.entrySet () ) { System.out.print (entry.getValue () + “ “);
}
}
}
What is the result?
public static void main (String [ ] args) {
Map
unsortMap.put (5, “b”);
unsortMap.put (1, “d”);
unsortMap.put (7, “e”);
unsortMap.put (50, “j”);
Map
@Override public int compare (Integer o1, Integer o2) {return o2.compareTo
(o1); } } );
treeMap.putAll (unsortMap);
for (Map.Entry
}
}
}
What is the result?
Question 9
Which two are elements of a singleton class? (Choose two.)
Question 10
Assume customers.txt is accessible and contains multiple lines. Which code fragment prints the contents of the customers.txt file?
Question 11
Given the code fragment:
BiFunction val = (t1, t2) -> t1 + t2; //line n1 System.out.println(val.apply(10, 10.5));
What is the result?
BiFunction
What is the result?
Question 12
Given that course.txt is accessible and contains:
Course : : Java
and given the code fragment:
public static void main (String[ ] args) { int i;
char c;
try (FileInputStream fis = new FileInputStream (“course.txt”); InputStreamReader isr = new InputStreamReader(fis);) { while (isr.ready()) { //line n1
isr.skip(2);
i = isr.read (); c = (char) i;
System.out.print(c);
}
} catch (Exception e) { e.printStackTrace();
}
}
What is the result?
Course : : Java
and given the code fragment:
public static void main (String[ ] args) { int i;
char c;
try (FileInputStream fis = new FileInputStream (“course.txt”); InputStreamReader isr = new InputStreamReader(fis);) { while (isr.ready()) { //line n1
isr.skip(2);
i = isr.read (); c = (char) i;
System.out.print(c);
}
} catch (Exception e) { e.printStackTrace();
}
}
What is the result?
Question 13
Given the code fragments: class Employee { Optional address;
Employee (Optional address) { this.address = address;
}
public Optional getAddress() { return address; }
}
class Address {
String city = “New York”;
public String getCity { return city: } public String toString() {
return city;
}
}
and
Address address = null;
Optional addrs1 = Optional.ofNullable (address);
Employee e1 = new Employee (addrs1);
String eAddress = (addrs1.isPresent()) ? addrs1.get().getCity() : “City Not available”;
What is the result?
Employee (Optional address) { this.address = address;
}
public Optional getAddress() { return address; }
}
class Address {
String city = “New York”;
public String getCity { return city: } public String toString() {
return city;
}
}
and
Address address = null;
Optional addrs1 = Optional.ofNullable (address);
Employee e1 = new Employee (addrs1);
String eAddress = (addrs1.isPresent()) ? addrs1.get().getCity() : “City Not available”;
What is the result?
Question 14
Given the code fragment:
Path file = Paths.get (“courses.txt”);
// line n1
Assume the courses.txt is accessible.
Which code fragment can be inserted at line n1 to enable the code to print the content of the courses.txt file?
Path file = Paths.get (“courses.txt”);
// line n1
Assume the courses.txt is accessible.
Which code fragment can be inserted at line n1 to enable the code to print the content of the courses.txt file?
Question 15
Given:
and the code fragment:
What is the result?
and the code fragment:
What is the result?
Question 16
Given the code fragment:
Path source = Paths.get (“/data/december/log.txt”); Path destination = Paths.get(“/data”);
Files.copy (source, destination);
and assuming that the file /data/december/log.txt is accessible and contains: 10-Dec-2014 – Executed successfully
What is the result?
Path source = Paths.get (“/data/december/log.txt”); Path destination = Paths.get(“/data”);
Files.copy (source, destination);
and assuming that the file /data/december/log.txt is accessible and contains: 10-Dec-2014 – Executed successfully
What is the result?
Question 17
Given:
public class Emp { String fName; String lName;
public Emp (String fn, String ln) { fName = fn;
lName = ln;
}
public String getfName() { return fName; } public String getlName() { return lName; }
}
and the code fragment: List emp = Arrays.asList ( new Emp (“John”, “Smith”),
new Emp (“Peter”, “Sam”),
new Emp (“Thomas”, “Wale”)); emp.stream()
//line n1
.collect(Collectors.toList());
Which code fragment, when inserted at line n1, sorts the employees list in descending order of fName and then ascending order of lName?
public class Emp { String fName; String lName;
public Emp (String fn, String ln) { fName = fn;
lName = ln;
}
public String getfName() { return fName; } public String getlName() { return lName; }
}
and the code fragment: List
new Emp (“Peter”, “Sam”),
new Emp (“Thomas”, “Wale”)); emp.stream()
//line n1
.collect(Collectors.toList());
Which code fragment, when inserted at line n1, sorts the employees list in descending order of fName and then ascending order of lName?
Question 18
Given:
and the code fragment:
What is the result?
and the code fragment:
What is the result?
Question 19
Given the code fragment:
Path path1 = Paths.get(“/app/./sys/”); Path res1 = path1.resolve(“log”);
Path path2 = Paths.get(“/server/exe/”); Path res1 = path1.resolve(“/readme/”); System.out.println(res1); System.out.println(res2);
What is the result?
Path path1 = Paths.get(“/app/./sys/”); Path res1 = path1.resolve(“log”);
Path path2 = Paths.get(“/server/exe/”); Path res1 = path1.resolve(“/readme/”); System.out.println(res1); System.out.println(res2);
What is the result?