My Blog

My WordPress Blog

My Blog

My WordPress Blog

2. Control Statements

Java Switch Statement

The Java switch statement executes one statement from multiple conditions. It is like if-else-if ladder statement. The switch statement works with byte, short, int, long, enum types, String and some wrapper types like Byte, Short, Int, and Long. Since Java 7, you can use strings in the switch statement. In other words, the switch statement tests the equality of a variable […]

Java If-else Statement

The Java if statement is used to test the condition. It checks boolean condition: true or false. There are various types of if statement in Java. Java if Statement The Java if statement tests the condition. It executes the if block if condition is true. Syntax: Example: Output: Java if-else Statement The Java if-else statement also tests the condition. It executes the if block if condition is […]

Java Control Statements | Control Flow in Java

Java compiler executes the code from top to bottom. The statements in the code are executed according to the order in which they appear. However, Java provides statements that can be used to control the flow of Java code. Such statements are called control flow statements. It is one of the fundamental features of Java, which provides […]

Scroll to top