1z0-809日本語試験無料問題集「Oracle Java SE 8 Programmer II (1z0-809日本語版) 認定」

シングルトンデザインパターンを使用してシングルトンクラスを作成します。
デザインのシングルトンの性質を強制する2つのステートメントはどれですか?

与えられた:
class Vehicle implements Comparable<Vehicle>{
int vno;
String name;
public Vehicle (int vno, String name) {
this.vno = vno,;
this.name = name;
}
public String toString () {
return vno + ":" + name;
}
public int compareTo(Vehicle o) {
return this.name.compareTo(o.name);
}
and this code fragment:
Set<Vehicle> vehicles = new TreeSet <> ();
vehicles.add(new Vehicle (10123, "Ford"));
vehicles.add(new Vehicle (10124, "BMW"));
System.out.println(vehicles);
結果は何ですか?

コードの断片を考えると:
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?

コードの断片を考えると:
Path file = Paths.get ("courses.txt");
// line n1
courses.txtにアクセスできると仮定します。
コードがcourses.txtファイルの内容を印刷できるようにするために、どのコードフラグメントをn1行目に挿入できますか?

どのクラス定義がコンパイルされますか?

customers.txtにアクセス可能であり、複数の行が含まれていると仮定します。
customers.txtファイルの内容を印刷するコードフラグメントはどれですか?

抽象クラスの代わりにインターフェイスを使用する必要がある2つの理由はどれですか?

コードの断片を考えると:
List<String> empDetails = Arrays.asList("100, Robin, HR",
"200, Mary, AdminServices",
"101, Peter, HR");
empDetails.stream()
.filter(s-> s.contains("1"))
.sorted()
.forEach(System.out::println); //line n1
What is the result?

コードの断片を考えると:

結果は何ですか?

Given:

and the code fragment:

What is the result?