if (布尔表达式) { 语句组; } 例子: if(radius >= 0){ area = radius * radius * PI; System.out.println("The area for the circle of radius " + radius + "is:" + area ); }
if (布尔表达式){ 布尔表达式为真时执行语句组; }else { 布尔表达式为假时执行语句组; }
if (i > j){ if(j > k){ System.out.println("k is the smallest."); }else System.out.println("i is less than or equal to k"); }


判断闰年:(year % 4 == 0 && year % 100 != 0 || (year % 400 == 0))
位运算符:

switch(witch表达式){ case 值1: 语句组1; break; case 值2:语句组2; break; ... case 值n : 语句组n; break; default: 默认情况下执行的语句组; }
布尔表达式 ? 表达式1:表达式2;
boolean-expression ? expression1 : expression2; max = (num1 > num2)? num1 : num2;
跟C语言的printf函数类似
System.out.println(format, item1, item2, ..., itemk);
e.g.: int count = 5; double amount = 45.56; System.out.println("count is %d and amount is %f", count, amount);
原文:http://www.cnblogs.com/luts/p/5000213.html