加载中
Java List Initialization in One Line

1. Introduction In this quick tutorial, we'll investigate how can we initialize a List using one-liners. 2. Create From an Array We can create a List from an array and thanks to...

01/30 18:38
163
Java Custom Annotations Example

In this tutorial, we will show you how to create two custom annotations – @Test and @TestInfo, to simulate a simple unit test framework. P.S This unit test example is inspired ...

01/30 16:42
126
Comparing getPath(), getAbsolutePath(), and getCanonicalPath() in Java

1. Overview The java.io.File class has three methods — getPath(), getAbsolutePath() and getCanonicalPath() — to obtain the filesystem path. In this article, we'll have a quick...

01/29 23:05
203
Check If a String Is Numeric in Java

1. Introduction Oftentimes while operating upon Strings, we need to figure out whether a String is a valid number or not. In this tutorial, we’ll explore multiple ways to detec...

Number of Digits in an Integer in Java

1. Introduction In this quick tutorial, we'll explore different ways of getting the number of digits in an Integer in Java. We'll also analyze those different methods and will f...

How to Round a Number to N Decimal Places in Java

1. Overview In this short article, we're going to look at how to round a number to n decimal places in Java. 2. Decimal Numbers in Java Java provides two primitive types that ca...

Java Timer

1. Timer – The Basics Timer and TimerTask are java util classes used to schedule tasks in a background thread. In a few words – TimerTask is the task to perform and Timer is ...

Java – Random Long, Float, Integer and Double

1. Generate an Unbounded Long Let's start with generating a Long: 1 2 3 4 @Test public void givenUsingPlainJava_whenGeneratingRandomLongUnbounded_thenCorrect() { long generatedL...

01/29 21:57
90
Java 8 – Powerful Comparison with Lambdas

1. Overview In this tutorial, we're going to take a first look at the Lambda support in Java 8 – specifically at how to leverage it to write the Comparator and sort a Collecti...

01/29 21:50
51
Binary Numbers in Java

1. Introduction The binary number system uses 0s and 1s to represent numbers. Computers use binary numbers to store and perform operations on any data. In this tutorial, we'll l...

01/29 21:38
37
Concrete Class in Java

1. Introduction In this quick guide, we'll discuss the term “concrete class” in Java. First, we'll define the term. Then, we'll see how it's different from interfaces and abst...

A Guide to the finalize Method in Java

1. Overview In this tutorial, we'll focus on a core aspect of the Java language – the finalize method provided by the root Object class. Simply put, this is called before the g...

01/29 21:22
26
Object Type Casting in Java

1. Overview The Java type system is made up of two kinds of types: primitives and references. We covered primitive conversions in this article, and we’ll focus on references ca...

01/29 21:08
58
Quick Guide to java.lang.System

1. Overview In this tutorial, we'll take a quick look at the java.lang.System class and its features and core functionality. 2. IO System is a part of java.lang, and one of its ...

01/29 20:50
92
Wrapper Classes in Java

1. Overview As the name suggests, wrapper classes are objects encapsulating primitive Java types. Each Java primitive has a corresponding wrapper: boolean, byte, short, char, in...

01/29 20:26
86
Guide to the Volatile Keyword in Java

1. Overview In this quick article, we'll focus on a foundational but often misunderstood concept in the Java language – the volatile keyword. In Java, each thread has a separat...

01/29 17:44
107
Inheritance and Composition (Is-a vs Has-a relationship) in Java

1. Overview Inheritance and composition — along with abstraction, encapsulation, and polymorphism — are cornerstones of object-oriented programming (OOP). In this tutorial, w...

01/29 17:35
45
Using Java Assertions

1. Introduction The Java assert keyword allows developers to quickly verify certain assumptions or state of a program. In this article, we'll take a look at how to use the Java ...

01/29 17:19
100
Class Loaders in Java

1. Introduction to Class Loaders Class loaders are responsible for loading Java classes during runtime dynamically to the JVM (Java Virtual Machine). Also, they are part of the ...

01/28 23:02
208
Guide to the Synchronized Keyword in Java

1. Overview This quick article will be an intro to using the synchronized block in Java. Simply put, in a multi-threaded environment, a race condition occurs when two or more th...

01/28 22:11
84

没有更多内容

加载失败,请刷新页面

返回顶部
顶部