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

Given:
class Book {
int id;
String name;
public Book (int id, String name) {
this.id = id;
this.name = name;
}
public boolean equals (Object obj) { //line n1
boolean output = false;
Book b = (Book) obj;
if (this.name.equals(b name))}
output = true;
}
return output;
}
}
and the code fragment:
Book b1 = new Book (101, "Java Programing");
Book b2 = new Book (102, "Java Programing");
System.out.println (b1.equals(b2)); //line n2
どちらの説明が正しいですか?

与えられた:
public class Counter {
public static void main (String[ ] args) {
int a = 10;
int b = -1;
assert (b >=1) : "Invalid Denominator";
int = a / b;
System.out.println (c);
}
}
-eaオプションを使用してコードを実行した結果はどうなりますか?

Given:
public class Test<T> {
private T t;
public T get () {
return t;
}
public void set (T t) {
this.t = t;
}
public static void main (String args [ ] ) {
Test<String> type = new Test<>();
Test type 1 = new Test ();//line n1
type.set("Java");
type1.set(100);//line n2
System.out.print(type.get() + " " + type1.get());
}
}
結果は何ですか?

JDBC3.0を使用してデータベースドライバーをロードするには、どのアクションを使用できますか?

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

Given:

とコードの断片:

結果は何ですか?

解説: (GoShiken メンバーにのみ表示されます)
コードの断片を考えると:
interface CourseFilter extends Predicate<String> {
public default boolean test (String str) {
return str.contains ("Java");
}
}
and
List<String> strs = Arrays.asList("Java", "Java EE", "Embedded Java");
Predicate<String> cf1 = s - > s.length() > 3;
Predicate cf2 = new CourseFilter() { //line n1
public boolean test (String s) {
return s.startsWith ("Java");
}
};
long c = strs.stream()
.filter(cf1)
.filter(cf2//line n2
.count();
System.out.println(c);
結果は何ですか?

同期とロックについて正しい2つのステートメントはどれですか? (2つ選択してください。)

解説: (GoShiken メンバーにのみ表示されます)
Given that /green.txt and /colors/yellow.txt are accessible, and the code fragment:
Path source = Paths.get("/green.txt);
Path target = Paths.get("/colors/yellow.txt);
Files.move(source, target, StandardCopyOption.ATOMIC_MOVE);
Files.delete(source);
どちらの説明が正しいですか?

Given:
class Bird {
public void fly () { System.out.print("Can fly"); }
}
class Penguin extends Bird {
public void fly () { System.out.print("Cannot fly"); }
}
and the code fragment:
class Birdie {
public static void main (String [ ] args) {
fly( ( ) -> new Bird ( ));
fly (Penguin : : new);
}
/* line n1 */
}
Which code fragment, when inserted at line n1, enables the Birdie class to compile?

コードの断片を考えると:
Map <Integer、String> books = new TreeMap <>();
books.put(1007、「A」);
books.put(1002、 "C");
books.put(1001、 "B");
books.put(1003、「B」);
System.out.println(書籍);
結果は何ですか?

解説: (GoShiken メンバーにのみ表示されます)
コードの断片を考えると:
Path path1 = Paths.get("/app/./sys/");
Path res1 = path1.resolve("log");
Path path2 = Paths.get("/server/exe/");
Path res1 = path2.resolve("/readme/");
System.out.println(res1);
System.out.println(res2);
結果は何ですか?

Given:
interface Doable {
public void doSomething (String s);
}
Which two class definitions compile?

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

そして

結果は何ですか?

コードの断片を考えると:
class Caller implements Callable<String> {
String str;
public Caller (String s) {this.str=s;}
public String call()throws Exception { return str.concat ("Caller");}
}
class Runner implements Runnable {
String str;
public Runner (String s) {this.str=s;}
public void run () { System.out.println (str.concat ("Runner"));}
}
and
public static void main (String[] args) InterruptedException,
ExecutionException {
ExecutorService es = Executors.newFixedThreadPool(2);
Future f1 = es.submit (new Caller ("Call"));
Future f2 = es.submit (new Runner ("Run"));
String str1 = (String) f1.get();
String str2 = (String) f2.get();//line n1
System.out.println(str1+ ":" + str2);
}
結果は何ですか?

与えられた:
public class Counter {
public static void main (String[ ] args) {
int a = 10;
int b = -1;
assert (b >=1) : "Invalid Denominator";
int = a / b;
System.out.println (c);
}
}
-daオプションを使用してコードを実行した結果はどうなりますか?

コードの断片を考えると:
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 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 ()) {
recDelete (aFile.getAbsolutePath ());
} else {
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.
結果は何ですか?