import java.util.Arrays;
import java.util.Scanner;
public class test {
public static void main(String[] args) {
// TODO Auto-generated method stub
int a,b,c;
System.out.println("请输入三个整数:");
Scanner input = new Scanner(System.in);
a = input.nextInt();
b = input.nextInt();
c = input.nextInt();
triangle(a,b,c);
// TODO Auto-generated method stub
int a,b,c;
System.out.println("请输入三个整数:");
Scanner input = new Scanner(System.in);
a = input.nextInt();
b = input.nextInt();
c = input.nextInt();
triangle(a,b,c);
}
public static void triangle(int a,int b,int c) throws IllegalArgumentException{
int[] number = {a,b,c};
Arrays.sort(number);//排序
public static void triangle(int a,int b,int c) throws IllegalArgumentException{
int[] number = {a,b,c};
Arrays.sort(number);//排序
if (number[0]+number[1] > number[2] && number[2]-number[1] < number[0]) {
System.out.println(a+" "+b+" "+c);
System.out.println("可以构成三角形");
}else{
System.out.println("a="+a+",b="+b+",c="+c+"不能构成三角形");
throw new IllegalArgumentException();
}
}
}
System.out.println(a+" "+b+" "+c);
System.out.println("可以构成三角形");
}else{
System.out.println("a="+a+",b="+b+",c="+c+"不能构成三角形");
throw new IllegalArgumentException();
}
}
}