Java If-else 语句

If-else 语句告诉程序仅在特定测试评估为真时才执行特定代码段,否则执行 else 块。

我们可以嵌套 if-else 块。

public class JavaExample 
{
	public static void main(String[] args) 
	{
		boolean condition = true;

		if(condition) {
			System.out.println("条件为true");
		} 
		else 
		{
			System.out.println("条件为false");
		}
	}
}
日期:2020-09-17 00:10:18 来源:oir作者:oir