String Comparison and Immutability
References
Your blog category
References
Java provides a mechanism to convert between primitive data types and their corresponding wrapper classes. This conversion is categorized into two processes: Autoboxing: Converting a primitive type to its wrapper class object. Unboxing: Converting a wrapper class object to its primitive type. Conversion Methods Example Program: Demonstrating Conversion Between Wrappers and Primitives Conversion between wrappers …
Java’s primitive data types can be categorized into four major categories: Integer Types (byte, short, int, long) Floating-Point Types (float, double) Character Type (char) Boolean Type (boolean) Example Program Java provides eight primitive data types categorized into four main groups: Integer, Floating-Point, Character, and Boolean. These data types are the building blocks of data manipulation …
Java Reflection API is part of the java.lang.reflect and java.lang packages. It allows inspection and manipulation of classes, interfaces, constructors, methods, and fields at runtime—even if they are private. This capability is extremely useful for frameworks, development tools, and advanced operations such as serialization, dependency injection, and testing. What is the Reflection API? The Reflection …
The java.lang package in Java provides fundamental classes that are automatically imported into every Java program. The Class class, specifically java.lang.Class, is a core class in this package. It represents classes and interfaces in a running Java application, serving as the entry point for Java’s reflection API. Below is a detailed explanation of the Class …
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 …
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 …
The Files class is part of the java.nio.file package introduced in Java 7. It contains static methods that operate on files, directories, or other types of files.Files is a utility class and cannot be instantiated. Utility class for file and directory operations. Provides methods to create, delete, copy, move, read, write, and check file attributes. …
CharBuffer is part of the java.nio package and is a buffer for handling characters. It is useful for character-based input/output operations, such as text parsing, network communication, or file processing. It works similarly to ByteBuffer but specifically stores 16-bit char values. Commonly Used Methods Simple Program using CharBuffer Writing and Reading Characters Problem Statement: LotusJavaPrince …