· JAVA – Syntax – Conditional Statements
tutorial shows how to compare Primitive Types and Strings.
- Such comperisons are then used to create Conditional Statements.
- Conditonal statements are used to:
- define which part of the program should be executed next, like when
using if...else statements,
- define which part of the program should be executed multiple times
in a loop, like when using for statements.
- Conditional statements are executed depending on true or false value
of Logical Expression within it.
- Logical Expressions are evaluated using Comparison Operators
resulting in one of two possible results: false or true.
- Logical Expression can be combined using Conditional Operators:
&& for AND, || fro OR and ! for NOT.
Negation operator '!' inverts false to true and vice versa.