/**
* Java Common Control flow statements
* @author JAVAWG
* @version 2016-11-20
* */
public class Iftest {
public static void main (string[] Args) {
TODO auto-generated Method Stub
int a = 3;
int B = 5;
If (a > B) {
System.out.println ("A > B");
} else if (a < B) {
System.out.println ("A < B");
} else {
System.out.println ("A = = B");
}
}
}
/**
* Switch case Conditional control statement
* @author JAVAWG
* @version 2016-11-20
* */
public class Switchtest {
public static void main (string[] Args) {
TODO auto-generated Method Stub
int a = 2;
Switch (a) {
Case 1:
System.out.println ("a=1");
break;
Case 2:
System.out.println ("a=2");
break;
Case 3:
System.out.println ("a = 3");
break;
Default:
System.out.println ("default Output result");
}
}
}
/**
* Conditional Control statement while
* @author JAVAWG
* @version 2016-11-20
* */
public class Whiletest {
public static void main (string[] Args) {
TODO auto-generated Method Stub
int a = 1; Loop variable
int sum = 0; The result of the increased storage cycle.
While (a <100) {
Sum + = a;
a++;
}
System.out.println ("loop Output result:" +sum);
}
}
Common Java Control statements