package com.company;
import java.util.Scanner;
public class Main{
public static void main(String[] args){
byte b_max = Byte.MAX_VALUE;
byte b_min = Byte.MIN_VALUE;
short s_max = Short.MAX_VALUE;
short s_min = Short.MIN_VALUE;
int i_max = Integer.MAX_VALUE;
int i_min = Integer.MIN_VALUE;
long l_max = Long.MAX_VALUE;
long l_min = Long.MIN_VALUE;
//调用类中的常量获取最大最小值
System.out.println("byte max="+ b_max);
System.out.println("byte min="+ b_min);
System.out.println("short max="+s_max);
System.out.println("short min="+s_min);
System.out.println("int max="+i_max);
System.out.println("int min="+i_min);
System.out.println("long max="+l_max);
System.out.println("long min="+l_min);
}
}
java-求最大值最小值
最新推荐文章于 2023-04-13 20:13:01 发布