1/4
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
Java Statement
Statement – line of code ending with a semicolon (;)
Simple Statement – basic building block of a program
Compound Statement / Block – group of statements enclosed in { }
Control Structure
Control Structure – changes the order of statement execution
Decision Control – selects which code to execute
Repetition Control – repeats code several times
Types – if, if-else, if-else-if, switch
Understanding if Statements
if Statement – executes code only if condition is true
Boolean Expression – condition evaluated as true or false
If Structure – determines action based on test value
Syntax – if (condition) statement;
Complex Conditionals
if-else Statement
if-else Statement – executes one block if true, another if false
Boolean Expression – decides which block runs
Syntax –
if (condition)
statement1;
else
statement2;
Nested if Statement
Nested if – an if statement inside another if
Used for – multiple levels of conditions
Switch, Case, and Break Statements
switch case Statement
Switch Statement – multi-way branch with several choices
Case – specific condition or value to test
break Statement – ends a case block
default Statement – runs when no case matches
Syntax Example:
switch (variable) {
case 1: ... break;
case 2: ... break;
default: ...
}
Summary Keywords:
if – condition true, else – otherwise, nested if – inside another if, switch – multiple choices, break – end case, default – fallback case