Home > Java > Javagetting Started > body text

What does if in java mean?

(*-*)浩
Release: 2019-11-15 09:54:20
Original
4043 people have browsed it

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.

What does if in java mean?

##Grammar

The syntax of the if statement is as follows: java course)

If the value of the Boolean expression is true, the code block in the if statement is executed, otherwise the code after the if statement block is executed.

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 语句");
      }
   }
}
Copy after login

The above code is compiled and run and the results are as follows:

这是 if 语句
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!