0% found this document useful (0 votes)
21 views35 pages

Reviewer

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views35 pages

Reviewer

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 35

GRADE 9 -Review

Nested If statement
● A nested if is an if statement that is the target of another if or else. Nested if statements mean an if
statement inside an if statement
What is Nested in else body?
if statement is in the if body then both the outer if condition and
the inner if conditions must evaluate to true before the inner if the body can run.
Switch Statement
● The switch statement evaluates an expression, matching the
expression's value to a case clause, and executes statements
associated with that case.
● It is used when we have multiple options. In other words, it
executes only one statement from multiple conditions.
● This statement is like an if-else-if ladder. 
● The switch statement evaluates an expression, matching the
expression's value to a case clause, and executes statements associated
with that case.
● The break statement is used to end the processing of a particular
labeled statement within the switch statement.
● A case clause is used to ensure that the expression matches the
specified value, and continues until either the end of the switch
statement or a break.
● A default clause is executed if the value of expression doesn't match
any of the case clauses.
Output:
Outstanding!
Output:
advance java
● Deciding whether to use if-then-else statements or a switch statement is based on readability
and the expression that the statement is testing.
● An if-then-else statement can test expressions based on ranges of values or conditions. In
contrast, a switch statement tests expressions based only on a single integer, enumerated
value, or String object.
● Each break statement terminates the enclosing switch statement. Control flow continues with
the first statement following the switch block.
● The break statements are necessary because statements in switch blocks fall through without
them:
● All statements after the matching case label are executed in sequence, regardless of the
expression of subsequent case labels, until a break statement is encountered.
WHILE LOOP STATEMENT
A while loop statement in Java programming language repeatedly executes a target statement
as long as a given condition is true.
 
Syntax
 
while(Boolean_expression)
{
// Statements
}
Initialization expression: 
The compiler checks to make sure that you have assigned a
value before you use a local variable.
Example:
int i = 1;
Test Expression:
 In this expression, we have to test the condition.
If the condition evaluates to true then we will execute the
body of the loop and go to update expression. Otherwise, we
will exit from the while loop.
 Example:
i <= 10
Update Expression
After executing the loop body,   this expression increments/decrements the
loop variable by some value.
                           Example:
                                       i++ or  i=i+1
                                                i- - or i=i-1
Endless Loop
● The endless loop is also called an infinite loop. If the loop condition never evaluates to false, the
loop body is executed continuously without end. If the loop body has no output, the endless loop
makes the computer appear to hang.  Do remember that aborting the program will interrupt the
infinite loop.
Nested While Loop
What is the syntax of a nested while loop?
Syntax:
  ASCII
●    acronym for American Standard Code for
Information Interchange.
● The total number of Characters in ASCII is 256 (0 to 255).

● 0 to 31(total 32 characters) is called ASCII control characters.


● 32 to 127 character is called ASCII printable characters.
● 128 to 255 is called The extended ASCII codes.
Sample ASCII value and its corresponding
character:

● 48 to 57 is numbers 0 to 9
● 65 to 90 is uppercase A to Z
● 97 to 122 is lowercase a to z
MERRY Christmas and Happy New
Year!

GOD BLESS EVERYONE 

You might also like