JAVA案例二(获取三个数中的最大值) 迷南。 2024-04-17 06:07 9阅读 0赞 # JAVA案例二(获取三个数中的最大值) # package com.igeek_05; /** * @ClassName: OperatorTest2 * @Description: 获取三个整数中的最大值 * @date 2017年10月11日 下午7:31:48 * Company www.igeekhome.com * * 获取三个整数中的最大值 */ public class OperatorTest2 { public static void main(String[] args) { // 定义三个int类型的变量 int a = 10; int b = 30; int c = 20; // 先比较两个整数的大值 int temp = ((a > b) ? a : b); int max = ((temp > c) ? temp : c); System.out.println("max:" + max); } }
还没有评论,来说两句吧...