public class Ex03_1 { public static void main(String[] args) { int x, y, z; // 変数宣言:int型の変数3つ x, y, z を宣言 double result; // 変数宣言:double型の変数 result を宣言:結果保持用 boolean flag; // 変数宣言:boolean型(論理値型)の変数を宣言 x = 153; // 値 153 を 変数 x に代入 y = 266; // 値 266 を 変数 y に代入 z = 371; // 値 371 を 変数 z に代入 result = x + y + z; // 3つの値の合計を計算し,結果を result に代入 System.out.println(x + " + " + y + " + " + z + " = " + result + "だよ"); result = result / 3; // 3つの平均を計算し,結果をresultに代入 System.out.println(x + ", " + y + ", " + z + "の平均は " + result + "だよ"); flag = true; System.out.println("今日は晴れだね? ... お答えrobot「" + flag + " de su」"); flag = false; System.out.println("今日の昼食はフルコースだね? ... お答えrobot「" + flag + " de su」"); } }