Package Collection;import Org.omg.corba.systemexception;public class Ifexpression {public static void main (string[] args) { //if expression for Boolean expression or Boolean value//First way int a=5;int b=7;int c=84;if (a<b) {System.out.println ("a less than B");} The second way if (a>b) {System.out.println ("a greater than B");} else {System.out.println ("A is less than B");} The Third Way if (a>b) { System.out.println ("A greater than B");} else if (c<b) {System.out.println ("C less than B");} else {System.out.println ("C is greater than B");}}}
Enum class
Package Collection;import Java.util.scanner;public class Switchexpression {//enum type enum Season{spring,hot,fall,winner} ;p ublic static void Main (string[] args) {//TODO auto-generated method stub////Here is an integer value//scanner scanner=new Scanner (System . in);//int int1=scanner.nextint ();//switch (int1)//{//case 1://{//system.out.println ("A");//break;//}//case 2://{/ /system.out.println ("B");//break;//}//default://{//system.out.println ("Stop");//}//////85////stop season Tianqi=season.fall; Switch (TIANQI) {case spring: { System.out.println ("Spring"); Case Fall: { System.out.println ("Autumn"); Default:break;}}}
It is important to note that the 1 enumeration class uses the basic format of the 2 switch statement 3 to pay attention to break, if break does not write, the program may be compared with the value in each case
Java Process Control--2017.08.01