Module 5: Java Control Statements

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/4

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

5 Terms

1
New cards

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 { }

2
New cards

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

3
New cards

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

  • Syntaxif (condition) statement;

4
New cards

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

5
New cards

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