If
// Boolean i = true; // if (i = = True) {// System.out.println ("executes if"); // }else{// System.out.println ("perform else"); // }
Switch
//int i =;//switch (i) {//Case ://System.out.println ("You're stupid");//Break ;//Case ://System.out.println ("You are more Foolish");//Break ;//Case ://System.out.println ("You're a little silly");//Break ;//Case ://System.out.println ("You are normal");//Break ;// }
While
// int i = 1; // Int j = Ten; // While (i<j) {// System.out.println (i+ "*" +j+ "=" +i*j); // i++; // j--; // }
Do While:
// Do {// System.out.println (i+ "*" +j+ "=" +i*j); // i++; // j--; // } while (I<J); // For (i = 1;i<j;i++) {// System.out.println (i+ "*" +j+ "=" +i*j); // j--; // }
Positive triangle, inverted triangle:
int i; int J; for (i = 3;i>=-3;i--) { int a = Math.Abs (i); Take the absolute value for (j = a;j>0;j--) { System.out.print ("*"); } System.out.println (""); }
Operation Result:
***
**
*
*
**
***
99 Multiplication:
Public class Test03 { publicstaticvoid main (string[] args) { // 99 multiplication Table int i; int J; for (i = 1;i<=9;i++) { for (j = 1;j<=i;j++) { System.out.print (J+ "*" +i+ " = "+i*j+" \ T "); } System.out.println (); }}}
Operation Result:
1*1=1
1*2=22*2=4
1*3=32*3=63*3=9
1*4=42*4=83*4=124*4=16
1*5=52*5=103*5=154*5=205*5=25
1*6=62*6=123*6=184*6=245*6=306*6=36
1*7=72*7=143*7=214*7=285*7=356*7=427*7=49
1*8=82*8=163*8=244*8=325*8=406*8=487*8=568*8=64
1*9=92*9=183*9=274*9=365*9=456*9=547*9=638*9=729*9=81
Java Program Structure