if语句包含一个布尔表达式和一条或多条语句。
if(Boolean_expression) { //如果布尔表达式为真,语句将执行 }
public class Test { public static void main(String args[]) { int x=10; if( x < 20 ) { System.out.print("This is if statement"); } } }
这将产生以下输出-
This is if statement.
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)