Welcome to the comprehensive Java API Documentation guide, your ultimate reference for mastering the Java classes and APIs/methods of the Java standard library. This guide provides an in-depth understanding and practical knowledge of the core packages, classes, interfaces, and methods that form the backbone of Java programming.
This guide covers API guides on important methods, classes and interfaces from Java packages – java.lang
, java.util
, java.util.function
, java.time
, and java.stream
and more. It includes detailed descriptions of each class, method, and interface, with links to in-depth tutorials that explain their usage, syntax, practical examples, and real-world applications.
Whether you’re new to Java or looking to deepen your understanding, this resource provides valuable insights into the foundational elements of the Java programming language.
If you are new to Java programming, learn everything about Java: Learn Java Programming.
Java Lang Package – Classes and Interfaces
Class/Interface | Description |
---|---|
Java String Class | Represents a sequence of characters. Provides methods for string manipulation and comparison. |
Java Object Class | The root class of the Java class hierarchy. All other classes are subclasses of the Object class. |
Java Integer Class | Wraps a value of the primitive type int in an object. Provides methods for converting int to String and vice versa. |
Java Thread Class | Represents a thread of execution in a program. Provides methods to manage threads and their lifecycle. |
Java Class | Instances of this class represent classes and interfaces in a running Java application. |
Java Exception Class | The superclass of all classes that represent recoverable exceptions in Java. |
Java RuntimeException Class | The superclass of all classes that represent runtime exceptions in Java. |
Java NullPointerException | Thrown when an application attempts to use null in a case where an object is required. |
Java IllegalArgumentException | Thrown to indicate that a method has been passed an illegal or inappropriate argument. |
Java Math Class | Wraps a value of the primitive type boolean in an object. Provides methods to convert a boolean to a String and vice versa. |
Java Boolean Class | Represents a collection of elements that can be iterated over. |
Java Long Class | Wraps a value of the primitive type long in an object. Provides methods for converting long to String and vice versa. |
Java Double Class | Wraps a value of the primitive type double in an object. Provides methods for converting double to String and vice versa. |
Java Float Class | Wraps a value of the primitive type float in an object. Provides methods for converting float to String and vice versa. |
Java Byte Class | Wraps a value of the primitive type byte in an object. Provides methods for converting byte to String and vice versa. |
Java Character Class | Wraps a value of the primitive type char in an object. Provides methods for character manipulation. |
Java Short Class | Wraps a value of the primitive type short in an object. Provides methods for converting short to String and vice versa. |
Java @Override Annotation | Indicates that a method is intended to override a method in a superclass. |
Java AutoCloseable Interface | Defines a single method, close, that closes a resource. |
Java Iterable Interface | Thrown when an exceptional arithmetic condition has occurred, such as dividing by zero. |
Java CharSequence Interface | Represents a readable sequence of char values. |
Java Comparable Interface | Allows objects of a class to be compared for ordering. |
Java Cloneable Interface | Indicates that a class allows its instances to be cloned. |
Java @Deprecated Annotation | Marks a program element as deprecated. |
Java @SafeVarargs Annotation | Suppresses unchecked warnings for variable arity parameter methods. |
Java ThreadLocal Class | Provides thread-local variables. |
Java ClassNotFoundException | Thrown when an application tries to load a class through its string name but no definition for the class is found. |
Java ClassCastException | Thrown to indicate that the code has attempted to cast an object to a subclass of which it is not an instance. |
Java ArithmeticException | Thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression), and no definition of the class could be found. |
Java ArrayIndexOutOfBoundsException | Thrown to indicate that an array has been accessed with an illegal index. |
Java IllegalStateException | Thrown to indicate that a method has been invoked at an illegal or inappropriate time. |
Java IllegalAccessException | Thrown when an application tries to reflectively create an instance (other than an array), set or get a field, or invoke a method, but the currently executing method does not have access to the definition of the specified class, field, method or constructor. |
Java InstantiationException | Thrown when an application tries to create an instance of a class using the newInstance method in class Class, but the specified class object cannot be instantiated because it is an interface or abstract class. |
Java InterruptedException | Thrown when a thread is waiting, sleeping, or otherwise occupied, and the thread is interrupted, either before or during the activity. |
Java CloneNotSupportedException | Thrown to indicate that the clone method in class Object has been called to clone an object, but that the object’s class does not implement the Cloneable interface. |
Java SecurityException | Thrown by the security manager to indicate a security violation. |
Java NoSuchFieldException | Signals that the class doesn’t have a field of a specified name. |
Java NoSuchMethodException | Signals that the class doesn’t have a method of a specified name. |
Java ArrayStoreException | Thrown to indicate that an attempt has been made to store the wrong type of object into an array of objects. |
Java StackOverflowError | Thrown when a stack overflow occurs because an application recurses too deeply. |
Java NoClassDefFoundError | Thrown when the Java Virtual Machine cannot allocate an object because it is out of memory, and no more memory can be made available by the garbage collector. |
Java StringIndexOutOfBoundsException | Thrown by String methods to indicate that an index is either negative or greater than the size of the string. |
Java OutOfMemoryError | Thrown when the Java Virtual Machine cannot allocate an object because it is out of memory, and no more memory could be made available by the garbage collector. |
Java NoSuchMethodError | Thrown if an application tries to call a specified method of a class (either static or instance), and that class no longer has a definition of that method. |
Java Process Class | Provides control of native processes started by ProcessBuilder.start and Runtime.exec. |
Java Runnable Interface | Represents a task that can be executed by a thread. |
Java ThreadGroup Class | Represents a group of threads. |
Java System Class | Provides access to system-related information and resources including standard input, standard output, and error output streams; access to externally defined properties and environment variables; a means of loading files and libraries; and a utility method for quickly copying a portion of an array. |
Java Runtime Class | Represents the runtime environment in which the application is running and provides methods to interact with the runtime system. |
Java IndexOutOfBoundsException | Thrown to indicate that an index of some sort (such as to an array, to a string, or to a vector) is out of range. |
Java Util Package – Classes and Interfaces
Class/Interface | Description |
---|---|
Java List Interface | Represents an ordered collection (also known as a sequence). |
Java ArrayList Class | Provides a hash table-based implementation of the Map interface. |
Java HashMap Class | It contains various methods for manipulating arrays (such as sorting and searching). |
Java HashSet Class | Implements the Set interface, backed by a hash table. |
Java Map Interface | Represents a mapping between a key and a value. |
Java Arrays Class | Contains various methods for manipulating arrays (such as sorting and searching). |
Java Collections Class | Represents a collection designed to hold elements prior to processing. |
Java Iterator | Provides an iterator over a collection. |
Java Queue Interface | Represents a collection designed for holding elements prior to processing. |
Java Deque Interface | Represents a double-ended queue that supports element insertion and removal at both ends. |
Java EnumSet Class | Represents a specific instant in time with millisecond precision. |
Java NavigableSet Interface | Represents a SortedSet extended with navigation methods. |
Java NavigableMap Interface | Represents a SortedMap extended with navigation methods. |
Java Date Class | Represents a specific instant in time, with millisecond precision. |
Java Dictionary Class | Represents a key/value pair dictionary. |
Java EnumMap Class | Represents a specialized Map implementation for use with enum type keys. |
Java Formattable Interface | Provides a way to use custom formatting in a printf-style format string. |
Java Formatter Class | Provides support for formatting values according to a format string. |
Java Hashtable Class | Implements a hashtable, which maps keys to values. |
Java IdentityHashMap | Implements a hash table using reference equality for comparing keys and values. |
Java ListIterator Interface | Extends Iterator to allow bidirectional traversal of a list and the modification of elements. |
Java Locale Class | Represents a specific geographical, political, or cultural region. |
Java NoSuchElementException Class | Thrown by various accessor methods to indicate that the element being requested does not exist. |
Java Optional Class | A container object which may or may not contain a non-null value. |
Java OptionalDouble Class | A container object which may or may not contain a double value. |
Java OptionalInt Class | A container object which may or may not contain an int value. |
Java OptionalLong Class | A container object which may or may not contain a long value. |
Java PriorityQueue Class | Provides an unbounded priority queue based on a priority heap. |
Java Properties Class | Represents a persistent set of properties which can be loaded and saved from/to a stream. |
Java SequencedCollection Interface | Represents a collection that maintains the order of elements. |
Java SequencedMap Interface | Represents a map that maintains the order of entries. |
Java SequencedSet Interface | Represents a set that maintains the order of elements. |
Java Set Interface | Represents a collection that contains no duplicate elements. |
Java SortedMap Interface | Represents a map that maintains its entries in ascending order of keys. |
Java SortedSet Interface | Represents a set that maintains its elements in ascending order. |
Java Spliterator Interface | Provides an object for traversing and partitioning elements of a source. |
Java Stack Class | Represents a last-in-first-out (LIFO) stack of objects. |
Java StringJoiner Class | Provides a way to construct a sequence of characters separated by a delimiter and optionally starting with a supplied prefix and ending with a supplied suffix. |
Java StringTokenizer Class | Provides a way to break a string into tokens. |
Java UUID Class | Represents an immutable universally unique identifier (UUID). |
Java WeakHashMap Class | Implements a hash table with weak keys, allowing entries to be garbage-collected when their keys are no longer in ordinary use. |
Java Calendar Class | Provides methods for converting between a specific instant in time and a set of calendar fields. |
Java Base64 Class | Provides methods for encoding and decoding using the Base64 encoding scheme. |
Java ConcurrentModificationException | Thrown when a method detects concurrent modification of an object when such modification is not permissible. |
Java Comparator Interface | Defines a method for comparing two objects for order. |
Java Currency Class | Represents a currency. |
Java Scanner Class | Provides methods for parsing primitive types and strings using regular expressions. |
Java Util Function Package – Classes and Interfaces
Class/Interface | Description |
---|---|
Java Function | Represents a function that accepts one argument and produces a result. |
Java Predicate | Represents a predicate (boolean-valued function) of one argument. |
Java Supplier | Represents a supplier of results. |
Java Consumer | Represents an operation that accepts a single input argument and returns no result. |
Java BiFunction | Represents a function that accepts two arguments and produces a result. |
Java BinaryOperator | Represents an operation upon two operands of the same type, producing a result of the same type as the operands. |
Java BiConsumer | Represents an operation that accepts two input arguments and returns no result. |
Java IntConsumer | Represents an operation that accepts a single int-valued argument and returns no result. |
Java DoubleConsumer | Represents an operation that accepts a single double-valued argument and returns no result. |
Java LongConsumer | Represents an operation that accepts a single long-valued argument and returns no result. |
Java IntFunction | Represents a function that accepts an int-valued argument and produces a result. |
Java LongFunction | Represents a function that accepts a long-valued argument and produces a result. |
Java IntPredicate | Represents a predicate (boolean-valued function) of one int-valued argument. |
Java LongPredicate | Represents a predicate (boolean-valued function) of one long-valued argument. |
Java ToDoubleFunction | Represents a function that produces a double-valued result. |
Java ToIntFunction | Represents a function that produces an int-valued result. |
Java ToLongFunction | Represents a function that produces a long-valued result. |
Java IntSupplier | Represents a supplier of int-valued results. |
Java DoubleSupplier | Represents a supplier of double-valued results. |
Java BiPredicate | Represents a predicate (boolean-valued function) of two arguments. |
Java BooleanSupplier | Represents a supplier of boolean-valued results. |
Java IntBinaryOperator | Represents an operation upon two int-valued operands, producing an int-valued result. |
Java DoubleBinaryOperator | Represents an operation upon two double-valued operands, producing a double-valued result. |
Java LongBinaryOperator | Represents an operation upon two long-valued operands, producing a long-valued result. |
Java IntToDoubleFunction | Represents a function that accepts an int-valued argument and produces a double-valued result. |
Java IntToLongFunction | Represents a function that accepts an int-valued argument and produces a long-valued result. |
Java LongToDoubleFunction | Represents a function that accepts a long-valued argument and produces a double-valued result. |
Java LongToIntFunction | Represents a function that accepts a long-valued argument and produces an int-valued result. |
Java DoubleToIntFunction | Represents a function that accepts a double-valued argument and produces an int-valued result. |
Java DoubleToLongFunction | Represents a function that accepts a double-valued argument and produces a long-valued result. |
Java ObjDoubleConsumer | Represents an operation that accepts an object-valued and a double-valued argument and returns no result. |
Java ObjIntConsumer | Represents an operation that accepts an object-valued and an int-valued argument, and returns no result. |
Java ObjLongConsumer | Represents an operation that accepts an object-valued and a long-valued argument and returns no result. |
Java ToDoubleBiFunction | Represents a function that accepts two arguments and produces a double-valued result. |
Java ToIntBiFunction | Represents a function that accepts two arguments and produces an int-valued result. |
Java ToLongBiFunction | Represents a function that accepts two arguments and produces a long-valued result. |
Java UnaryOperator | Represents an operation on a single operand that produces a result of the same type as its operand. |
Java IntUnaryOperator | Represents an operation on a single int-valued operand that produces an int-valued result. |
Java DoubleUnaryOperator | Represents an operation on a single double-valued operand that produces a double-valued result. |
Java LongUnaryOperator | Represents an operation on a single long-valued operand that produces a long-valued result. |
Java Stream Package – Classes and Interfaces
Class/Interface | Description |
---|---|
Java Stream | Represents a sequence of elements supporting sequential and parallel aggregate operations. |
Java Collectors | Provides implementations of reduction operations, such as accumulating elements into collections, summarizing elements according to various criteria, etc. |
Java IntStream | Represents a sequence of primitive int-valued elements supporting sequential and parallel aggregate operations. |
Java DoubleStream | Represents a sequence of primitive double-valued elements supporting sequential and parallel aggregate operations. |
Java StreamSupport | Provides utility methods for creating and manipulating streams. |
Java Time Package – Classes and Interfaces
Class/Interface | Description |
---|---|
Java LocalDate | Represents a time (hour, minute, second, nanosecond) without a time zone. |
Java LocalDateTime | Represents a date-time without a time-zone in the ISO-8601 calendar system, such as 2007-12-03T10:15:30. |
Java LocalTime | Represents a time (hour, minute, second, nanosecond) without a time-zone. |
Java Instant | Represents a specific moment in time, typically represented as a number of seconds and nanoseconds since the epoch of 1970-01-01T00:00:00Z. |
Java OffsetDateTime | Represents a date-time with an offset from UTC/Greenwich in the ISO-8601 calendar system, such as 2007-12-03T10:15:30+01:00. |
Java OffsetTime | Represents a time with an offset from UTC/Greenwich in the ISO-8601 calendar system, such as 10:15:30+01:00. |
Java ZonedDateTime | Represents a date-time with a time-zone in the ISO-8601 calendar system, such as 2007-12-03T10:15:30+01:00 Europe/Paris. |
Java Year | Represents a year in the ISO-8601 calendar system. |
Java YearMonth | Represents a year-month in the ISO-8601 calendar system, such as 2007-12. |
Java Period | Represents a date-based amount of time in the ISO-8601 calendar system, such as ‘2 years, 3 months and 4 days’. |
Java Duration | Represents a time-based amount of time, such as ‘34.5 seconds’. |
Java DayOfWeek | Represents a day-of-week, such as ‘Tuesday’. |
Java Month | Represents a month-of-year, such as ‘July’. |
Java MonthDay | Represents a month-day in the ISO-8601 calendar system, such as ‘–12-03’. |
Java Clock | Provides access to the current instant, date, and time using a time zone. |
Java ZoneId | Represents a time-zone identifier, such as ‘Europe/Paris’. |
Java ZoneOffset | Represents a time-zone offset from UTC/Greenwich. |
Java DateTimeException | Thrown to indicate a problem while calculating or converting a date-time. |
Java DateTimeFormatter | Provides a way to print and parse date-time objects. |
Commonly Used Java Methods/APIs
Java Lang Package – Important Classes and its Methods/APIs
Class | Description |
---|---|
Java String Class Methods | Provides methods to manipulate and handle string data. |
Java Object Class Methods | Defines the root class of the Java class hierarchy. |
Java Integer Class Methods | Provides methods for converting int values and working with Integer objects. |
Java Double Class Methods | It provides methods for converting double values and working with double objects. |
Java Long Class Methods | It provides methods for converting long values and working with long objects. |
Java Boolean Class Methods | Provides methods for converting boolean values and working with Boolean objects. |
Java Character Class Methods | Provides methods for working with char values. |
Java Short Class Methods | It provides methods for converting short values and working with short objects. |
Java Byte Class Methods | Provides methods for converting byte values and working with Byte objects. |
Java Class Methods | Provides methods for working with Java class objects. |
Java Thread Class Methods | Provides methods for managing and controlling threads. |
Java Math Class Methods | Provides methods for performing basic numeric operations. |
Java System Class Methods | Provides access to system-related resources and properties. |
Java Package Class Methods | Provides methods to get information about the implementation and specification of a package. |
Java ThreadLocal Class Methods | Provides thread-local variables. |
Java ThreadGroup Class Methods | Provides methods for managing groups of threads. |
Java Throwable Class Methods | Provides methods for handling exceptions and errors. |
Java Enum Class Methods | Provides methods for working with enum types. |
Java CompletableFuture Methods | Provides methods for asynchronous programming. |
Java Executors Class Methods | Provides factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory, and Callable classes. |
Java ThreadPoolExecutor Class Methods | Provides methods for managing a pool of threads. |
Java StringBuilder Methods | Provides methods for manipulating the sequence of characters. |
Java StringTemplate Class Methods | Provides methods for template-based string operations. |
Java Util Package – Important Classes and their Methods/APIs
Class | Description |
---|---|
Java ArrayList Class Methods | Provides methods for managing dynamic arrays. |
Java HashMap Class Methods | Provides methods for managing hash tables and key-value pairs. |
Java Scanner Class Methods | Provides methods for parsing primitive types and strings using regular expressions. |
Java LinkedList Class Methods | Provides methods for managing linked lists. |
Java HashSet Class Methods | Provides methods for managing sets backed by a hash table. |
Java LinkedHashSet Class Methods | Provides methods for managing linked hash sets. |
Java CopyOnWriteArraySet Class Methods | Provides methods for managing thread-safe sets where elements cannot be changed once added. |
Java PriorityQueue Class Methods | Provides methods for managing priority queues. |
Java EnumSet Class Methods | Provides methods for managing sets of enum types. |
Java LinkedHashMap Class Methods | Provides methods for managing linked hash maps. |
Java TreeMap Class Methods | Provides methods for managing maps sorted according to the natural ordering of its keys. |
Java EnumMap Class Methods | Provides methods for managing specialized maps with enum keys. |
Java ConcurrentHashMap Class Methods | Provides methods for managing thread-safe hash tables. |
Java CopyOnWriteArrayList Class Methods | Provides methods for managing thread-safe lists where elements cannot be changed once added. |
Java Stack Class Methods | Provides methods for managing last-in-first-out (LIFO) stacks. |
Java Currency Class Methods | Provides methods for working with currency values. |
Java Objects Class Methods | Provides methods for working with objects and performing operations such as comparisons and null checks. |
Java Util Function Package – Important Classes and their Methods/APIs
Class | Description |
---|---|
Java Stream Methods | Provides methods for working with streams, allowing functional-style operations on sequences of elements. |
Java Collectors Class Methods | Provides implementations of reduction operations, such as accumulating elements into collections. |
Java IntStream Methods | Provides methods for working with streams of primitive int values. |
Java LongStream Methods | Provides methods for working with streams of primitive long values. |
Java DoubleStream Methods | Provides methods for working with streams of primitive double values. |
Java Time Package – Important Classes and their Methods/APIs
Class | Description |
---|---|
Java LocalDate Class Methods | Provides methods for working with times (hour, minute, second, nanosecond) without a time zone. |
Java LocalTime Class Methods | Provides methods for working with times (hour, minute, second, nanosecond) without a time-zone. |
Java LocalDateTime Class Methods | Provides methods for working with date times without a time zone. |
Java ZonedDateTime Class Methods | Provides methods for working with date times with a time zone. |
Java Instant Class Methods | Provides methods for working with a specific moment in time. |
Java Duration Class Methods | Provides methods for working with time-based amounts of time. |
Java Clock Class Methods | Provides methods for accessing the current instant, date, and time using a time zone. |