day03-if的学习
This commit is contained in:
24
day03/src/com/inmind/Demo01_if.java
Normal file
24
day03/src/com/inmind/Demo01_if.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.inmind;
|
||||
/*
|
||||
if格式一:
|
||||
|
||||
if(判断条件){
|
||||
语句;
|
||||
}
|
||||
|
||||
执行顺序:先执行判断条件,判断条件必须是布尔型的结果,
|
||||
如果为true,就执行大括号内部的语句,false就直接跳过大括号中的内容
|
||||
*/
|
||||
public class Demo01_if {
|
||||
public static void main(String[] args) {
|
||||
//判断下变量对应的值
|
||||
int i = 12;
|
||||
if (i!=10){
|
||||
System.out.println("i不为10");
|
||||
}
|
||||
|
||||
System.out.println("程序结束");
|
||||
//判断2个值谁大,请用if判断流程来判断
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user