Files
java-question/Question22-FunctionAndLambda/src/PTra22_03.java
2026-09-09 08:34:32 +09:00

39 lines
1.1 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import java.util.Arrays;
import java.util.List;
import java.util.Random;
/*
* PTra22_03.java
* 作成 Rhizome
*------------------------------------------------------------
* Copyright(c) Rhizome Inc. All Rights Reserved.
*/
/* TODO 関数型インターフェースを作成してから始めてください。
* インターフェース名:CalcMultiParamFunc
* 抽象メソッド名:CalcMultiParamFunction
* ジェネリクス:T
* 戻り値の型:int
* 引数:T型の引数を3つ
*
* */
public class PTra22_03 {
public static void main(String[] args) {
List<Integer> array = Arrays.asList(1,2,3,4,5,6,7,8,9);
Random rnd = new Random();
System.out.println("計算元の値です");
for(Integer number : array) {
System.out.print(number + "\t");
}
int rndNumber1 = rnd.nextInt(9);
int rndNumber2 = rnd.nextInt(9);
int rndNumber3 = rnd.nextInt(9);
System.out.println("\n" + "ランダムに数値を3つ選び足し算します(選ばれた順に足し算します)");
/* TODO 作成した関数型インターフェースを使用し、Calc.additionを実行してください
*
* */
}
}