Home >Java >Javagetting Started >What does if in java mean?
If in Java is the guide word of a conditional statement. An if statement contains a Boolean expression and one or more statements. The if keyword indicates conditional execution of a block of code. The condition must evaluate to a Boolean value.
##Grammar
The syntax of the if statement is as follows: java course)if(布尔表达式)
{
//如果布尔表达式为true将执行的语句
}
The if statement is used to determine whether the given condition is met, and one of the two operations given is executed based on the result of the determination (true or false).
The return value of if is true or false, which can be stored in a bool variable and occupies one byte.
Test.java file code:public class Test {
public static void main(String args[]){
int x = 10;
if( x < 20 ){
System.out.print("这是 if 语句");
}
}
}
这是 if 语句
The above is the detailed content of What does if in java mean?. For more information, please follow other related articles on the PHP Chinese website!