Home >Java >JavaBase >What does java if(x) mean?

What does java if(x) mean?

angryTom
angryTomOriginal
2019-11-18 13:38:405557browse

What does java if(x) mean?

java what does if(x) mean

This is the if conditional judgment statement in java, after if Inside the brackets is an expression, which is executed when the expression is true and not executed when the expression is false.

java if(x) means that when the value of variable x is not empty, not 0, not false, or not null, the following content will be executed.

if statement: used for judgment, can be single branch or multiple branches

Single branch:

if(判断语句){
    //满足,则执行的代码块
}else{
    //不满足判断语句时,执行的代码块
}

multiple Branch:

if(判断语句1){
//满足判断语句1,执行的代码块
}else if(判断语句2){
//不满足判断语句1,满足判断语句2,执行代码块
}else{
//既不满足语句1,也不满足语句2,执行的代码块
}

php Chinese website, a large number of free Java introductory tutorials, welcome to learn online!

The above is the detailed content of What does java if(x) mean?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn