An if statement runs a block of code only when a condition is true. Without it, every line executes no matter what, so your program can't react to different inputs or states.
int temperature = 35;
if (temperature > 30) {
System.out.println("It is hot outside");
}
The condition inside the parentheses must produce a boolean value. If it evaluates to true, the code inside the curly braces runs. If it evaluates to false, the entire block is skipped and execution continues after the closing brace.
Notice the structure: if keyword, parenthesized condition, then a block wrapped in {}. The braces are optional for single statements, but skipping them causes bugs when you add a second line later. Always use braces.