1.1.3 编写程序从命令行得到3个参数,看是否相等。
import java.util.Scanner;
import java.util.InputMismatchException;
public class experiment1 {
//这里不写static会报找不到主类问题。
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int a,b,c;
try{
a=sc.nextInt();
b=sc.nextInt();
c=sc.nextInt();
if(a==b&&a==c)
System.out.print("ok!");
}catch(InputMismatchException e){
System.out.print("Input type mismatch error!");
}
}
}