1z0-809 試験問題 111
与えられた:
パブリッククラスの製品{
int id; int価格;
public Product(int id、int price){
this.id = id;
this.price=価格;
}
public String toString(){return id + ":"+価格; }
}
およびコードフラグメント:
List <Product> products = Arrays.asList(new Product(1、10)、
新製品(2、30)、
新製品(2、30));
製品p=products.stream()。reduce(new Product(4、0)、(p1、p2)-> {
p1.price + = p2.price;
新しい商品を返す(p1.id、p1.price);});
products.add(p);
products.stream()。parallel()
.reduce((p1、p2)-> p1.price> p2.price?p1:p2)
.ifPresent(System.out::println);
結果はどうなりますか?
パブリッククラスの製品{
int id; int価格;
public Product(int id、int price){
this.id = id;
this.price=価格;
}
public String toString(){return id + ":"+価格; }
}
およびコードフラグメント:
List <Product> products = Arrays.asList(new Product(1、10)、
新製品(2、30)、
新製品(2、30));
製品p=products.stream()。reduce(new Product(4、0)、(p1、p2)-> {
p1.price + = p2.price;
新しい商品を返す(p1.id、p1.price);});
products.add(p);
products.stream()。parallel()
.reduce((p1、p2)-> p1.price> p2.price?p1:p2)
.ifPresent(System.out::println);
結果はどうなりますか?
1z0-809 試験問題 112
与えられた:
クラスBird{
public void fly(){System.out.print( "Can fly"); }
}
クラスペンギンは鳥を拡張します{
public void fly(){System.out.print( "Cannot fly"); }
}
およびコードフラグメント:
クラスバーディー{
public static void main(String [] args){
fly(()-> new Bird());
飛ぶ(ペンギン::新しい);
}
/*行n1*/
}
行n1に挿入されたときに、Birdieクラスのコンパイルを可能にするコードフラグメントはどれですか?
クラスBird{
public void fly(){System.out.print( "Can fly"); }
}
クラスペンギンは鳥を拡張します{
public void fly(){System.out.print( "Cannot fly"); }
}
およびコードフラグメント:
クラスバーディー{
public static void main(String [] args){
fly(()-> new Bird());
飛ぶ(ペンギン::新しい);
}
/*行n1*/
}
行n1に挿入されたときに、Birdieクラスのコンパイルを可能にするコードフラグメントはどれですか?
1z0-809 試験問題 113
与えられた:

およびコードフラグメント:

結果はどうなりますか?

およびコードフラグメント:

結果はどうなりますか?
1z0-809 試験問題 114
与えられた:結果は何ですか?


1z0-809 試験問題 115
与えられた:
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()){f.open(); }}}コードがOpenCloseを印刷できるようにする2つの変更はどれですか?
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()){f.open(); }}}コードがOpenCloseを印刷できるようにする2つの変更はどれですか?