I.C.T. 9
I.C.T. 9
* Multiplication
—------------- TRUTH TABLES —-------------
/ Division 1. NOT (!) OPERATOR
- Is an unary operator that negates the
% Modulo value of the operand
++ Increment
OPERAND 1 RESULT
-- Decrement
! True False
...TOPIC 1.2: COMPARISON OPERATORS .. ! False True
COMPARISON OPERATORS
- All relational operators are binary
operators primarily because they
indicate the relationship among two
operands
2. OR (||) OPERATOR —---------TOPIC 1.4: SHORTCUT—---------
- Is a binary operator that returns true if —--.----ASSIGNMENT OPERATORS —--.----
at least one of its operands is true
SHORTCUT ASSIGNMENT OPERATORS
- The shorthand operators include the
OPERAND 1 OPERAND 2 RESULT
assignment operator (=)
SWITCH
4. AND (&&) OPERATOR
- An alternative statement for else-if
- Is a binary operator that returns true
statement
only when both operands are true.
Otherwise, it will return false
IF STATEMENT
- The simplest among all the conditional
OPERAND 1 OPERAND 2 RESULT statement is the if statement
- With if statement, you can also execute
True && True True
several statements, just put them
True && False False within open and close braces
—--------- SYNTAX AND EXAMPLE —------- NOTE: The output for this ex. will be 1 2 3 4 5
SYNTAX: 12345123451234512345
for (i<initialization>; <test condition>;
<increment/operation>)
{ —--------TOPIC 3.3: WHILE LOOP —-------
<statement/s>
} WHILE LOOP
EXAMPLE: - The condition is at the beginning and
for (int x=7; x<=10; x++) the set of instructions inside the loop
{ will be repeated until this condition
System.out.print(x); becomes false
}
DO WHILE LOOP
- Is a type of loop wherein the code
would execute once before checking if
the value satisfies the condition
- Always executes first even if the value
is false. Value first before testing.
- The do-while loop is the only loop that
executes at least once. This is because
the condition for the loop is located at
the last part