Tag: core java
Java Switch
In this article, we will look over the switch keyword in Java and all the enhancements it has received up to JDK 17, including the switch expression. 1. What is a Switch Statement? Switch is a selection statement that allows you to control the flow of the execution of your application. It works as a…
While Loop in Java
In this article, we’ll go through while loop in Java, one of the fundamental statements that every programmer should now 1. What is a Java While Loop? Java While Loop is a statement that allows you to execute a set of commands only if a statement evaluates to true. Additionally, while loop is used when…
For Loop in Java
In this article, we’ll go through what for loop in Java is and how you can take full advantage of it. 1. What is a For Loop in Java Java for loop is a statement that allows you to run a set of commands, a predefined number of times(although if you use break or continue,…
Final Keyword in Java
In this article, we will go through what the final keyword does in Java, and when and how you should use it. 1. What Does final Mean in Java The final keyword in Java has a different meaning depending on where you apply it: When it comes to a variable, it means that you cannot…
Java 8 Stream API
In this article, we’ll learn everything regarding Java Stream API that was introduced in Java 8, through detailed examples. 1. What Is a Java Stream? You can think of a stream as a sequence of elements, that allows you to perform sequential and parallel operations. Furthermore, you cannot add any elements once the stream has…
Multithreading in Java
In this article, we will learn what multithreading is and how to multithread in Java. 1. Multithreading in Java Overview Java Multithreading allows us to execute multiple tasks at the same time preventing our application from hanging for a long time giving the impression it has frozen or crashed. 1.1 What’s a Thread? To understand…
How to Initialize an Array in Java
In this article, we’ll go through how you can initialize an array in java, through detailed examples. 1. How to Initialize a 1D Array To create a one-dimension array in Java, the formula is the following: For example, we could initialize an array of type Person and length 3, with the following command: In addition,…
For Each Loop in Java
In this article, we’ll go through what for each loop in Java is, and how you can use it. 1. What is a For Each Loop For Each Loop is like the classic for loop, but with a much simpler syntax than the classic for a loop as you only need to know the name…