| Exam Code/Number: | 1z0-809Join the discussion |
| Exam Name: | Java SE 8 Programmer II |
| Certification: | Oracle |
| Question Number: | 209 |
| Publish Date: | Dec 02, 2026 |
|
Rating
100%
|
|
Given the code fragments:
public class Book implements Comparator<Book> {
String name;
double price;
public Book () {}
public Book(String name, double price) {
this.name = name;
this.price = price;
}
public int compare(Book b1, Book b2) {
return b1.name.compareTo(b2.name);
}
public String toString() {
return name + ":" + price;
}
}
and
List<Book>books = Arrays.asList (new Book ("Beginning with Java", 2), new book ("A Guide to Java Tour", 3)); Collections.sort(books, new Book()); System.out.print(books); What is the result?
Given the code fragment:
BiFunction<Integer, Double, Integer> val = (t1, t2) -> t1 + t2;//line n1 System.out.println(val.apply(10, 10.5)); What is the result?
Given the code fragment:
public void recDelete (String dirName) throws IOException {
File [ ] listOfFiles = new File (dirName) .listFiles();
if (listOfFiles ! = null && listOfFiles.length >0) {
for (File aFile : listOfFiles) {
if (!aFile.isDirectory ()) {
if (aFile.getName ().endsWith (".class"))
aFile.delete ();
}
}
}
}
Assume that Projects contains subdirectories that contain .class files and is passed as an argument to the recDelete () method when it is invoked.
What is the result?
Given this code;
Which two are correct after this class is instantiated and tested?
Oracle.1z0-809.v2022-11-23.q176
Nov 23, 2022
Oracle.1z0-809.v2022-04-22.q171
Apr 22, 2022