public static void main(String[] args){
    int x;
    {
        ········
        ········复合语句1
        ········
        {
            ········
            ········复合语句2
            ········
        }
    }
}if(条件,布尔表达式){
    执行语句;
}不加{}也没有错误,但是为了可读性,加上为好。
switch(str){
    case str1:
        break;
    case str2:
        break;
    default:
}for(表达式1;表达式2;表达式3){
}java的一个特殊简化版本,不能完全取代for语句,但是对于遍历数组还是会方便。
int arr[]={1,4,7};
for(int x : arr){
    execute;
}原文:https://www.cnblogs.com/hasz/p/12199324.html