Java Theory - Conditional statement
The conditional statement is a construction that allows a program to perform different computations depending on the value of a Boolean expression. If it is true , the program performs one computation; otherwise, if it is false , the program performs another computation. Here are some examples of Boolean expressions: a > b , i - j == 1 , and so on. The conditional statement has different forms. We will use all of them. The single if-case The simplest form of the conditional statement consists of the keyword if , a Boolean expression, and a body enclosed in curly braces. if (expression) { // body: do something } If the expression is true , the statements inside the code block are executed; otherwise, the program skips them. See the following example. int age = ...; // it has a value if (age...