Oracle Java SE 8 Programmer II (1z0-809日本語版) - 1z0-809日本語 模擬練習
コードの断片を考えると:
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<Path> 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<Path> 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?
正解: A
コードの断片を考えると:

結果は何ですか?

結果は何ですか?
正解: A
コードの断片を考えると:
public static void main (String [ ] args) throws IOException {
BufferedReader br = new BufferedReader (new InputStremReader
(System.in));
System.out.print ("Enter GDP: ");
//line 1
}
Which code fragment, when inserted at line 1, enables the code to read the GDP from the user?
public static void main (String [ ] args) throws IOException {
BufferedReader br = new BufferedReader (new InputStremReader
(System.in));
System.out.print ("Enter GDP: ");
//line 1
}
Which code fragment, when inserted at line 1, enables the code to read the GDP from the user?
正解: D
コードの断片を考えると:

結果は何ですか?

結果は何ですか?
正解: C
コードの断片を考えると:
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?
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?
正解: A
コードの断片を考えると:
List<Double> doubles = Arrays.asList (100.12, 200.32);
DoubleFunction funD = d -> d + 100.0;
doubles.stream (). forEach (funD); // line n1
doubles.stream(). forEach(e -> System.out.println(e)); // line n2
What is the result?
結果は何ですか?
List<Double> doubles = Arrays.asList (100.12, 200.32);
DoubleFunction funD = d -> d + 100.0;
doubles.stream (). forEach (funD); // line n1
doubles.stream(). forEach(e -> System.out.println(e)); // line n2
What is the result?
結果は何ですか?
正解: D
解説: (PassTest メンバーにのみ表示されます)
コードの断片を考えると:

Which code fragment, when inserted at line n1, enables the code to print /First.txt?

Which code fragment, when inserted at line n1, enables the code to print /First.txt?
正解: D
Given:

どのオプションが失敗しますか?

どのオプションが失敗しますか?
正解: C
コードの断片を考えると:
LocalDate valentinesDay =LocalDate.of(2015, Month.FEBRUARY, 14);
LocalDate nextYear = valentinesDay.plusYears(1);
nextYear.plusDays(15); //line n1
System.out.println(nextYear);
結果は何ですか?
LocalDate valentinesDay =LocalDate.of(2015, Month.FEBRUARY, 14);
LocalDate nextYear = valentinesDay.plusYears(1);
nextYear.plusDays(15); //line n1
System.out.println(nextYear);
結果は何ですか?
正解: C
プロパティファイルを使用してアプリケーションをローカライズするResourceBundleを作成するように求められました。
どのコード例では、メニュー1とメニュー2の有効なキーをファイルメニューと表示メニューの値で指定していますか?
どのコード例では、メニュー1とメニュー2の有効なキーをファイルメニューと表示メニューの値で指定していますか?
正解: C
コードの断片を考えると:

結果は何ですか?

結果は何ですか?
正解: D