
Number Formatting in Java
1. Overview In this tutorial, we’ll look at different approaches to number formatting in Java and how to implement them. 2. Basic Number Formatting with String#format […]
1. Overview In this tutorial, we’ll look at different approaches to number formatting in Java and how to implement them. 2. Basic Number Formatting with String#format […]
1. Introduction Passing immutable data between objects is one of the most common, but mundane tasks in many Java applications. Prior to Java 14, this […]
1. Overview There are many ways to check if a String contains a substring. In this article, we’ll be looking for substrings within a String while focusing on case-insensitive […]
1. Overview In this short tutorial, we’ll discuss different ways to compare two Long instances. We emphasize the problems that arise when using the reference comparison operator […]
1. Introduction In this tutorial, we’ll look at the overflow and underflow of numerical data types in Java. We won’t dive deeper into the more […]
1. Introduction In the tutorial Java Bean Validation Basics, we saw how we can apply javax validations using JSR 380 to various types. And in the tutorial Spring MVC Custom Validation, […]
1. Overview Java exceptions fall into two main categories: checked exceptions and unchecked exceptions. In this article, we’ll provide some code samples on how to use them. […]
1. Overview In this short tutorial, we’re going to learn about the Java XOR operator. We’ll go through a bit of theory about XOR operations, and then we’ll see […]
1. Introduction It’s quite common to run applications from the command-line using arguments. Especially on the server-side. Usually, we don’t want the application to do the […]
1. Introduction A copy constructor in a Java class is a constructor that creates an object using another object of the same Java class. That’s helpful when we […]
1. Introduction In this tutorial, we’ll focus on how to compare dates using the Java 8 Date/Time API. We’ll dive into different methods to check whether […]
1. Overview In this quick tutorial, we’ll illustrate multiple ways of converting time into Unix-epoch milliseconds in Java. More specifically, we’ll use: Core Java’s java.util.Date and Calendar Java 8’s […]
1. Introduction In this tutorial, we’ll consider anonymous classes in Java. We’ll describe how we can declare and create instances of them. We’ll also briefly […]
1. Overview Every class in Java is a child of the Object class either directly or indirectly. And since the Object class contains a toString() method, we can call toString() on any instance and […]
1. Overview In this tutorial, we’ll learn what the switch statement is and how to use it. The switch statement allows us to replace several nested if-else constructs and thus improve […]
1. Overview In this short tutorial, we’re going to show what the modulo operator is, and how we can use it with Java for some […]
1. Introduction In Java, Strings are immutable. An obvious question that is quite prevalent in interviews is “Why Strings are designed as immutable in Java?” […]
1. Overview In this tutorial, we’ll learn what makes an object immutable, how to achieve immutability in Java, and what advantages come with doing so. […]
1. Overview In this tutorial, we’ll cover how to create a custom exception in Java. We’ll show how user-defined exceptions are implemented and used for both […]
1. Overview In this tutorial, we’ll go through the basics of exception handling in Java as well as some of its gotchas. 2. First Principles […]