public class Test {
public static void main(String args[]){
int x = 30;
if( x == 10 ){
System.out.print("Value of X is 10");
}else if( x == 20 ){
System.out.print("Value of X is 20");
}else if( x == 30 ){
System.out.print("Value of X is 30");
}else{
System.out.print("This is else statement");
}
}
}
Value of X is 30
public class Test {
public static void main(String args[]){
int x = 30;
int y = 10;
if( x == 30 ){
if( y == 10 ){
System.out.print("X = 30 and Y = 10");
}
}
}
}
X = 30 and Y = 10
public class IfElseDemo06{
public static void main(String[] args){
int a=85; //声明int 型变量a 并赋值85
if (a>90){ //条件判断
System.out.println("成绩"+a+",是A 等级");
}else if (a>80){ //条件判断
System.out.println("成绩"+a+",是B 等级");
}else if (a>70){ //条件判断
System.out.println("成绩"+a+",是C 等级");
}else if (a>60){ //条件判断
System.out.println("成绩"+a+",是D 等级");
}else{
System.out.println("成绩"+a+",是B 等级");
}
}
}
成绩85,是B等级
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有