public class Compound{标签:控制,java,10,int,流程,System,while,println,out From: https://blog.51cto.com/u_15826214/5750137
public static void main(String args[]) {
int x = 10;
int j = 40;
{
int y = 40;
System.out.println(y);
int z = 245;
boolean b;
{
b = y > z;
System.out.println(b);
}
}
String word = "hello word";
System.out.println(word);
if (x > j) {
System.out.println('>');
}
if (x < j) {
System.out.println('<');
}
switch (x) {
case 'a':
System.out.println('a');
break;
case 10:
System.out.println(10);
break;
default:
System.out.println("other");
}
while (x <= j) {
System.out.println(x);
x++;
}
do {
System.out.println(x);
x++;
} while (x <= j);
//do{} while 比 while 多循环一次
for (x = 10; x <= j; x++) {
System.out.println(x);
}
char arr[] = {'a', 'b', 'c', 'd'};
for(char item : arr){
System.out.println(item);
}
Loop : for (x = 10; x <= j; x++) {
for (j = 0; j <= 10; j++) {
if(x == j) {
System.out.println("ok");
break Loop;
}
}
}
}
}