5 Things You Probably Didn’t Know About Java Concurrency

Thread is the heart of the Java programming language. When we run a Hello World Java program, we run on the main thread. And then, we can definitely create threads easily as we need to compose our application code to be functional, responsive, and performant at the same time. Think about a web server; it simultaneously handles hundreds of requests at the same time. In Java, we achieve this using multiple threads. While threads are helpful, it is dreadful to many of the developers. That's why in this article, I will share five interesting threading concepts that the beginner and intermediate developers might not know.  

1. The Program Order and The Execution Order Are Not the Same

When we write a code, we assume the code will be executed exactly the way we write it. However, in reality, this is not the case. The Java compiler may change the execution order to optimize it if it can determine that the output won't change in single-threaded code.

Top 10 Articles in the Java Zone: January 2021

Introduction

We get so many great articles here at DZone that it can sometimes be difficult to know where to find them, so we decided to compile them for you! We dug into Google analytics to find the top 10 most popular Java articles in January. Let's get started!

10. Java Getter and Setter: Basics, Common Mistakes, and Best Practices

What are getters and setters? This article aims to cover the basics as well as the best practices of getter and setter methods in Java.