Java study # 7 (branch syntax type)

Three types of if syntax

--What is an if statement? ** If the conditions are not met, do nothing ** A statement that can omit ** else ** if the result is ** false ** and nothing is done.

if ("Conditional expression"){
    //Block 1
}

--if-else What is the if-else syntax? ** If the conditions are not met, I would like to evaluate under different conditions ** ** if-else if-else syntax with a block starting with else if inserted before else **

if ("Conditional expression 1"){
    //Block 1
} else if ("Conditional expression 2"){
   //Block 2
} else if ("Conditional expression 3"){
  //Block 3
} else {
 //Last block
}

The if-else if-else syntax can branch into three or more routes in one statement. There are two rules in this syntax. One is that the else if block ** can be described multiple times **, but ** after the if block **, ** Can only be written before the else block **.

Chat

I have only written two types yet, but that's all for today ... There are a lot of things to sort out, but from tomorrow I'll try to update it a little earlier. I'm busy, so I'm afraid I'll be depressed, but I'll do my best to continue studying! About the switch syntax that I didn't use this time tomorrow! I will write this as well.

Recommended Posts

Java study # 7 (branch syntax type)
Java study # 1 (typical type)
Java control syntax
Java type conversion
Java control syntax
Let's study Java
[JAVA] Stream type
Java conditional branch
java conditional branch
[Java ~ Variable definition, type conversion ~] Study memo
[Java] Enumeration type
Java Optional type
Java study # 3 (type conversion and instruction execution)
Java double type
[Java] Study notes
Java 8 study (repeatable)
Java study memorandum
Study Java Silver 1
[Java] Conditional branch
[Java] Data type ①-Basic type
[Java ~ Method ~] Study memo (5)
[Java] Control syntax notes
[Java, Kotlin] Type Variance
Java class type field
Type determination in Java
[Java ~ Array ~] Study memo 4
My Study Note (Java)
[Java] Branch and repeat
[Java] About enum type
[Java] Date type conversion
Java basic syntax + α trap
Java learning memo (data type)
Study java arrays, lists, maps
Try functional type in Java! ①
[Java] Precautions for type conversion
Java Silver Study Method Memo
[Java ~ Boolean value ~] Study memo (2)
[Java] Type conversion speed comparison
Java study memo 2 with Progate
Java Primer Series (Type Conversion)
Study Java with Progate Note 1
[Java] Summary of control syntax
Syntax examples often used in Java
How to study Java Silver SE 8
[Java] Object-oriented syntax --class method / argument
[Java] Branch enum with switch statement
Summary of [Java silver study] package
[In-house study session] Java exception handling (2017/04/26)
[Study session memo] Java Day Tokyo 2017
[Java] Data type / matrix product (AOJ ⑧ Matrix product)
java (use class type for field)
Java study # 4 (conditional branching / if statement)
Orcacla Java Bronze SE 7/8 Qualification Study
[Java] Correct comparison of String type
Java study # 5 (iteration and infinite loop)
How to use Java enum type
Java and Swift comparison (2) Basic type / arithmetic expression / control syntax / function definition