-
public class IfTest {
-
-
public static void main(String[] args) {
-
int a = 200;
-
-
-
-
-
if (a == 20) {
-
System.out.println("a==20");
-
}
-
-
System.out.println("after if...");
-
}
-
}
-
-
class IfTest2 {
-
-
public static void main(String[] args) {
-
int a = 20;
-
if (a == 200) {
-
System.out.println("a==20");
-
} else {
-
System.out.println("else");
-
}
-
-
System.out.println("after if else ...");
-
}
-
}
-
-
class IfTest3 {
-
-
-
public static void main(String[] args) {
-
int a = 20;
-
if (a == 10) {
-
System.out.println("a==10");
-
} else if (a == 20) {
-
System.out.println("a==20");
-
} else if (a == 30) {
-
System.out.println("a==30");
-
} else {
-
System.out.println("else");
-
}
-
System.out.println("after if else if ...");
-
}
-
}
-
-
class Exer3 {
-
-
public static void main(String[] args) {
-
-
-
-
-
-
-
-
-
-
-
int score = Integer.parseInt(args[0]);
-
if (score > 100 || score < 0) {
-
System.out.println("ÊäÈëµÄÊý¾Ý·Ç·¨");
-
} else if (score == 100) {
-
System.out.println("½±ÀøÒ»Á¾BMW");
-
} else if (score > 80 && score <= 99) {
-
System.out.println("½±ÀøÒ»¸ǫ̈iphone6s");
-
} else if (score >= 60 && score <= 80) {
-
System.out.println("½±ÀøÒ»±¾²Î¿¼Êé");
-
} else {
-
System.out.println("ʲô½±ÀøÒ²Ã»ÓÐ");
-
}
-
}
-
}
-
-
-
-
-
-
-
-
public class IfTest {
-
-
public static void main(String[] args) {
-
int heigh = Integer.parseInt(args[0]);
-
int money = Integer.parseInt(args[1]);
-
boolean b = Boolean.parseBoolean(args[2]);
-
-
if (heigh > 180 && money > 1000 && b == true) {
-
System.out.println("ÎÒÒ»¶¨Òª¼Þ¸øËû!!!");
-
} else if (heigh > 180 || money > 1000 || b == true) {
-
System.out.println("¼Þ°É£¬±ÈÉϲ»×㣬±ÈÏÂÓÐÓà");
-
} else {
-
System.out.println("²»¼Þ£¡");
-
}
-
}
-
}
-
-
-
-
public class IfTest1 {
-
-
public static void main(String[] args) {
-
int num1 = Integer.parseInt(args[0]);
-
int num2 = Integer.parseInt(args[1]);
-
int num3 = Integer.parseInt(args[2]);
-
-
if (num1 > num2){
-
if (num3 > num1){
-
System.out.println(num2 + "," + num1 + "," + num3);
-
} else if (num2 > num3) {
-
System.out.println(num3 + "," + num2 + "," + num1);
-
} else{
-
System.out.println(num2 + "," + num3 + "," + num1);
-
}
-
}else {
-
if (num3 > num2) {
-
System.out.println(num1 + "," + num2 + "," + num3);
-
}else if(num1 > num3) {
-
System.out.println(num3 + "," + num1 + "," + num2);
-
}else {
-
System.out.println(num1 + "," + num3 + "," + num2);
-
}
-
}
-
}
-
}
-
-
class IfTest11 {
-
public static void main(String[] args) {
-
int num1 = Integer.parseInt(args[0]);
-
int num2 = Integer.parseInt(args[1]);
-
int num3 = Integer.parseInt(args[2]);
-
-
-
if (num1 > num2) {
-
int tmp = num1;
-
num1 = num2;
-
num2 = tmp;
-
}
-
-
if (num2 > num3) {
-
int tmp = num2;
-
num2 = num3;
-
num3 = tmp;
-
}
-
-
if (num1 > num2) {
-
int tmp = num1;
-
num1 = num2;
-
num2 = tmp;
-
}
-
System.out.println(num1 + "," + num2 + "," + num3);
-
}
-
}
|
|