Command-Line Arguments in Java

2021 VietMX 0

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 […]

Java Copy Constructor

2021 VietMX 0

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 […]

Comparing Dates in Java

2021 VietMX 0

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 […]

Convert Time to Milliseconds in Java

2021 VietMX 0

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 […]

Anonymous Classes in Java

2021 VietMX 0

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 […]

Java toString() Method

2021 VietMX 0

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 […]

Java Switch Statement

2021 VietMX 0

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 […]

Immutable Objects in Java

2021 VietMX 0

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. […]

The “final” Keyword in Java

2021 VietMX 0

1. Overview While inheritance enables us to reuse existing code, sometimes we do need to set limitations on extensibility for various reasons; the final keyword allows us to do […]

Guide to UUID in Java

2021 VietMX 0

1. Overview UUID (Universally Unique Identifier), also known as GUID (Globally Unique Identifier) represents a 128-bit long value that is unique for all practical purposes. The standard representation […]