Java Control Flow

Java 14

Java Enhanced Switch Expressions

In Java, a switch statement generally allows the application to have multiple possible execution paths based on the value of a given expression in runtime. The evaluated expression is called the selector expression which must be of type char, byte, short, int, Character, Byte, Short, Integer, String, or an enum. 1. Switch Expressions In Java …

Java Flow Control Statements

In Java, control flow statements help in conditionally executing statements based on whether the evaluation result is true or false.

Java continue Keyword

The Java continue statement skips the current iteration of a for loop, while loop, or do-while loop and moves to the next iteration.

Java break Statement

The break keyword in Java is used to terminate for, while, or do-while loops. It may also be used to terminate a switch statement as well.

Java Do-while

Java do-while loop executes the statements in do block, and then evaluates a condition in the while block to check whether to repeat the execution.

Java while Loop

The while loop in Java continually executes a block of statements until a particular condition evaluates to true, else the loop terminates.

Java For-each Loop

Since Java 1.5, the for-each loop or enhanced for loop is a concise way to iterate over the elements of an array and a Collection.

Java For Loop

Java for-loop statement is used to iterate over the arrays or collections using a counter variable that is incremented after each iteration.

Java Switch Statement

Java switch statements help in providing multiple possible execution paths for a program. Java switch statements can be used in place of if-else statements to write more cleaner and concise code. Java switch statements have evolved over time. In this tutorial, we will learn about basic switch statement features and …

Java If-else

Java if-else statements help the program execute the blocks of code only if the specified test condition evaluates to either true or false.

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.