Overriding equals(), hashCode(), and toString()
References
Overriding equals(), hashCode(), and toString() Read More »
The Object class in Java is the root of the class hierarchy. Every class in Java inherits from Object, either directly or indirectly, making it the ultimate superclass. It provides a set of fundamental methods that all classes can use or override. These methods are defined in the java.lang.Object package and are available to every
Object class methods and concepts Read More »
The java.lang package is a fundamental part of the Java programming language, providing classes that are essential for performing basic operations. It is automatically imported by default in every Java program, eliminating the need for explicit import statements. The java.lang package includes classes that handle basic data types, string manipulation, system operations, exception handling, and
Exploring java.lang package Read More »
MappedByteBuffer is a subclass of ByteBuffer that represents a memory-mapped region of a file. It allows you to read and write file contents directly in memory, enabling fast, random access to files—especially large ones. Part of Java’s NIO (New I/O) system Maps a region of a file into memory Changes to the buffer can reflect
Charset represents a character encoding scheme that maps characters to bytes and vice versa. It’s part of the java.nio.charset package and is essential for handling text in different languages and platforms. Why Charset? Computers store data as bytes, but human languages use characters. A Charset defines how characters like ‘A’, ‘你’, or ‘😊’ are translated
ByteOrder is a final class that defines byte ordering—endianness—used when reading or writing multibyte data types (like int, float, etc.) into a ByteBuffer. What is Byte Order? Byte order (endianness) refers to the order in which bytes are stored in memory: Big-endian: Most significant byte is stored first. Little-endian: Least significant byte is stored first.
The CompletionHandler is an interface used for handling the result of an asynchronous I/O operation (like AsynchronousFileChannel or AsynchronousSocketChannel). Interface Definition Program 1: Simple Asynchronous File Read LotusJavaPrince wants to read a file asynchronously using AsynchronousFileChannel, and Mahesh is tasked with writing the result to the console when the operation completes successfully or fails. Problem
Java I/O (Input/Output) operations play a critical role in reading data from sources (like files, sockets, or databases) and writing data to destinations (like disk files or client connections). Traditionally, Java used blocking I/O, which was simple but inefficient for high-performance or concurrent applications. To overcome this limitation, Asynchronous and Non-Blocking I/O models were introduced
Introduction to Asynchronous and Non Blocking I/O Read More »
The FileSystem class is part of the java.nio.file package.It represents a file system, which provides access to file stores, file attributes, and files themselves. FileSystem acts as a factory for Path objects.It abstracts the underlying file system (e.g., Windows, Unix, ZIP file system).You don’t create FileSystem instances directly; instead, you obtain them via the FileSystems
Path represents a path in the file system (either relative or absolute).It is part of the java.nio.file package introduced in Java 7. Used to locate a file or directory in a file system. Can be used to manipulate file paths easily. Path objects are immutable. Implemented by the class sun.nio.fs.UnixPath or WindowsPath depending on OS