Basic Control Flow: if Statement in Java


The if statement executes a block of code if a specified condition is true.

Source Code

int score = 75;
if (score > 70) {
    System.out.println("Passed");
}

Use if statements to make decisions in your code based on conditions.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments