Browse
java
9 posts in java.
- Jun 16 →
Understanding Java Object Memory Layout
This article provides a detailed introduction to the storage structure of Java objects in memory, discusses how to reasonably estimate the approximate memory space required for project operation through tools and theoretical knowledge, and deepens the understanding of the Java object memory structure.
- Jan 9 →
Packaging XML Files into Java Classpath
In Java project development, managing resource files such as XML configuration files is a common requirement. Especially when these resource files need to be in the same path as the compiled class files, correctly configuring the project becomes crucial. This article explores how to package XML files into the Java classpath in Maven projects and IntelliJ IDEA.
- Jan 4 →
New Features in Java 17
New features in Java 17
- Dec 29 →
ByteBuffer clear() Method vs compact() Method
The buffer.compact() and buffer.clear() are two different methods for buffer operations in Java NIO, with distinct functionalities and behaviors.
- Nov 12 →
ThreadLocal Usage Guide
ThreadLocal is used to maintain thread-local variables in a multi-threaded environment. It provides a simple mechanism that allows each thread to independently access and modify its own local copy of a variable without interfering with the copies of other threads.
- Nov 9 →
Guide to Using Java Thread Pools
A Java thread pool is a mechanism for managing and reusing threads. It consists of a set of pre-created threads that can be repeatedly used to execute tasks, eliminating the need to create and destroy threads for each task.
- Nov 2 →
The Ultimate Guide to Using volatile in Java
In Java, volatile is a keyword used to ensure memory visibility and prevent reordering issues in multi-threaded applications.
- Oct 17 →
How to Properly Stop a Java Thread
How to Properly Stop a Java Thread
- Oct 7 →
Ways to Create Threads in Java
This article explores the ways to create threads in Java based on JDK 11. My answer is that there are only two ways: extending the Thread class and implementing the Runnable interface, as stated in the Oracle official documentation.