咕泡Java百万架构精英领航班A2\/--》ccys1473
四、流程控制
1、分支语句
1.1 if-else-if
语法:
if(条件){
当条件为true时,执行大括号内的代码
}else if(条件){
}
补充:
//实例化扫描仪对象
Scanner sc = new Scanner(System.in);
System.out.println("请输入第一个值:");
int a = sc.nextInt();
System.out.println("请输入第二个值:");
int b = sc.nextInt();
System.out.println("求和结果:"+(a+b));
// String s = sc.next();
// System.out.println(s);
// double d = sc.nextDouble();