Author name: javaplanet.io

java.util.UUID

UUID (Universally Unique Identifier) is a class in java.util used to create unique identifiers that are 128-bit values, useful in distributed systems, databases, and unique object references. UUIDs are formatted as: Commonly Used Constructors and Methods Simple Program – Generate UUID Problem Statement LotusJavaPrince and Mahesh are managing a distributed document signing system for a …

java.util.UUID Read More »

java.util.Properties

java.util.Properties is a  subclass of Hashtable<Object, Object>.This is used to maintain lists of values in which both keys and values are strings.Ideal for configuration data like settings, messages, or environment variables.Often used to read/write .properties files in Java apps. Commonly used Constructors and Methods Simple Program Output Problem Statement: LotusJavaPrince and Mahesh are building a …

java.util.Properties Read More »

java.util.Scanner

The Scanner class in the java.util package is used to read input (text) from various input sources like: System.in (keyboard) Files Strings Input streams It provides parsing methods to read different types of data like int, float, double, boolean, String, etc., and is commonly used for interactive user input. Commonly Used Constructors and Methods Simple …

java.util.Scanner Read More »

java.util.Formatter

java.util.Formatter is a utility class used to format data (like numbers, strings, etc.) into formatted strings. It behaves similarly to C-style printf formatting and is often used in combination with String.format(), PrintWriter, or directly with console output. Formatter allows precise control over string formatting, such as padding, alignment, decimal precision, and locale-specific formatting. Commonly Used …

java.util.Formatter Read More »

java.util.StringTokenizer

StringTokenizer is a legacy class in the java.util package that allows you to break a string into tokens (words or parts) based on specified delimiters (e.g., comma, space, colon). It is often used for parsing text input. Although newer classes like String.split() or Scanner are recommended for modern development, StringTokenizer is still useful for simple …

java.util.StringTokenizer Read More »

java.util.Locale

The Locale class represents a specific geographical, political, or cultural region. It is used to tailor data (such as date formats, number formats, or messages) to the rules and conventions of a specific region. Each Locale object consists of: A language code (like “en” for English), An optional country code (like “US” for United States), …

java.util.Locale Read More »

java.util.Currency

The Currency class represents a currency as defined by the ISO 4217 standard. It provides information such as: Currency code (like “USD”) Symbol (like “$”) Default fraction digits (like 2 for cents in dollars) It’s immutable and thread-safe. Key Features One instance per currency (singleton per currency code) Supports getting currency by Locale or currency …

java.util.Currency Read More »

java.util.BitSet

BitSet is a class in the java.util package that implements a vector of bits that grows as needed. Each component of the bit set has a boolean value (true for 1 and false for 0). It is useful for storing flags, manipulating binary data, or working with sets efficiently using bit-level operations. Key Features: Dynamic …

java.util.BitSet Read More »

java.util.Random

The Random class is part of the java.util package and is used to generate pseudo-random numbers of different types: int, long, float, double, boolean, and Gaussian values. Based on a 48-bit seed using a linear congruential formula. Thread-safe only if externally synchronized. Can generate both bounded and unbounded values. Commonly Used Methods Simple Program: Lottery …

java.util.Random Read More »

Scroll to Top