1z0-809 試験問題 76

コードフラグメントが与えられた場合:

今の値が午前6時30分であると仮定します。
結果はどうなりますか?
  • 1z0-809 試験問題 77

    与えられた:
    パブリッククラス製品{
    int id; int価格;
    public Product(int id、int price){
    this.id = id;
    this.price=価格;
    }
    Public String toString(){return id + ":" + price;)
    }
    およびコードフラグメント:
    List <Product> products = new ArrayList <>(Arrays.asList(new Product(1、10)、
    新製品(2、30)、
    新製品(3、20));
    製品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 試験問題 78

    コードフラグメントが与えられた場合:
    List <String> nL = Arrays.asList( "Jim"、 "John"、 "Jeff");
    Function <String、String> funVal = s-> "Hello:" .contact(s);
    nL.Stream()
    .map(funVal)
    .peek(System.out :: print);
    結果はどうなりますか?
    こんにちは:ジムこんにちは:ジョンこんにちは:ジェフ
  • 1z0-809 試験問題 79

    コードフラグメントが与えられた場合:
    クラスCallerはCallable<String>{を実装します
    文字列str;
    public Caller(String s){this.str = s;}
    public String call()throws Exception {return str.concat( "Caller");}
    }
    クラスRunnerはRunnableを実装します{
    文字列str;
    public Runner(String s){this.str = s;}
    public void run(){System.out.println(str.concat( "Runner"));}
    }

    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"));
    文字列str1=(文字列)f1.get();
    文字列str2=(文字列)f2.get(); //行n1
    System.out.println(str1 + ":" + str2);
    }
    結果はどうなりますか?
  • 1z0-809 試験問題 80

    コードフラグメントが与えられた場合:
    String str="Javaはプログラミング言語です"; ToIntFunction <String> indexVal = str :: indexOf; // line n1 int x = indexVal.applyAsInt( "Java"); // line n2 System.out.println(x);
    結果はどうなりますか?