Java API Documentation

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/InterfaceDescription
Java String ClassRepresents a sequence of characters. Provides methods for string manipulation and comparison.
Java Object ClassThe root class of the Java class hierarchy. All other classes are subclasses of the Object class.
Java Integer ClassWraps a value of the primitive type int in an object. Provides methods for converting int to String and vice versa.
Java Thread ClassRepresents a thread of execution in a program. Provides methods to manage threads and their lifecycle.
Java ClassInstances of this class represent classes and interfaces in a running Java application.
Java Exception ClassThe superclass of all classes that represent recoverable exceptions in Java.
Java RuntimeException ClassThe superclass of all classes that represent runtime exceptions in Java.
Java NullPointerExceptionThrown when an application attempts to use null in a case where an object is required.
Java IllegalArgumentExceptionThrown to indicate that a method has been passed an illegal or inappropriate argument.
Java Math ClassWraps a value of the primitive type boolean in an object. Provides methods to convert a boolean to a String and vice versa.
Java Boolean ClassRepresents a collection of elements that can be iterated over.
Java Long ClassWraps a value of the primitive type long in an object. Provides methods for converting long to String and vice versa.
Java Double ClassWraps a value of the primitive type double in an object. Provides methods for converting double to String and vice versa.
Java Float ClassWraps a value of the primitive type float in an object. Provides methods for converting float to String and vice versa.
Java Byte ClassWraps a value of the primitive type byte in an object. Provides methods for converting byte to String and vice versa.
Java Character ClassWraps a value of the primitive type char in an object. Provides methods for character manipulation.
Java Short ClassWraps a value of the primitive type short in an object. Provides methods for converting short to String and vice versa.
Java @Override AnnotationIndicates that a method is intended to override a method in a superclass.
Java AutoCloseable InterfaceDefines a single method, close, that closes a resource.
Java Iterable InterfaceThrown when an exceptional arithmetic condition has occurred, such as dividing by zero.
Java CharSequence InterfaceRepresents a readable sequence of char values.
Java Comparable InterfaceAllows objects of a class to be compared for ordering.
Java Cloneable InterfaceIndicates that a class allows its instances to be cloned.
Java @Deprecated AnnotationMarks a program element as deprecated.
Java @SafeVarargs AnnotationSuppresses unchecked warnings for variable arity parameter methods.
Java ThreadLocal ClassProvides thread-local variables.
Java ClassNotFoundExceptionThrown when an application tries to load a class through its string name but no definition for the class is found.
Java ClassCastExceptionThrown to indicate that the code has attempted to cast an object to a subclass of which it is not an instance.
Java ArithmeticExceptionThrown 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 ArrayIndexOutOfBoundsExceptionThrown to indicate that an array has been accessed with an illegal index.
Java IllegalStateExceptionThrown to indicate that a method has been invoked at an illegal or inappropriate time.
Java IllegalAccessExceptionThrown 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 InstantiationExceptionThrown 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 InterruptedExceptionThrown when a thread is waiting, sleeping, or otherwise occupied, and the thread is interrupted, either before or during the activity.
Java CloneNotSupportedExceptionThrown 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 SecurityExceptionThrown by the security manager to indicate a security violation.
Java NoSuchFieldExceptionSignals that the class doesn’t have a field of a specified name.
Java NoSuchMethodExceptionSignals that the class doesn’t have a method of a specified name.
Java ArrayStoreExceptionThrown to indicate that an attempt has been made to store the wrong type of object into an array of objects.
Java StackOverflowErrorThrown when a stack overflow occurs because an application recurses too deeply.
Java NoClassDefFoundErrorThrown 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 StringIndexOutOfBoundsExceptionThrown by String methods to indicate that an index is either negative or greater than the size of the string.
Java OutOfMemoryErrorThrown 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 NoSuchMethodErrorThrown 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 ClassProvides control of native processes started by ProcessBuilder.start and Runtime.exec.
Java Runnable InterfaceRepresents a task that can be executed by a thread.
Java ThreadGroup ClassRepresents a group of threads.
Java System ClassProvides 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 ClassRepresents the runtime environment in which the application is running and provides methods to interact with the runtime system.
Java IndexOutOfBoundsExceptionThrown 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/InterfaceDescription
Java List InterfaceRepresents an ordered collection (also known as a sequence).
Java ArrayList ClassProvides a hash table-based implementation of the Map interface.
Java HashMap ClassIt contains various methods for manipulating arrays (such as sorting and searching).
Java HashSet ClassImplements the Set interface, backed by a hash table.
Java Map InterfaceRepresents a mapping between a key and a value.
Java Arrays ClassContains various methods for manipulating arrays (such as sorting and searching).
Java Collections ClassRepresents a collection designed to hold elements prior to processing.
Java IteratorProvides an iterator over a collection.
Java Queue InterfaceRepresents a collection designed for holding elements prior to processing.
Java Deque InterfaceRepresents a double-ended queue that supports element insertion and removal at both ends.
Java EnumSet ClassRepresents a specific instant in time with millisecond precision.
Java NavigableSet InterfaceRepresents a SortedSet extended with navigation methods.
Java NavigableMap InterfaceRepresents a SortedMap extended with navigation methods.
Java Date ClassRepresents a specific instant in time, with millisecond precision.
Java Dictionary ClassRepresents a key/value pair dictionary.
Java EnumMap ClassRepresents a specialized Map implementation for use with enum type keys.
Java Formattable InterfaceProvides a way to use custom formatting in a printf-style format string.
Java Formatter ClassProvides support for formatting values according to a format string.
Java Hashtable ClassImplements a hashtable, which maps keys to values.
Java IdentityHashMapImplements a hash table using reference equality for comparing keys and values.
Java ListIterator InterfaceExtends Iterator to allow bidirectional traversal of a list and the modification of elements.
Java Locale ClassRepresents a specific geographical, political, or cultural region.
Java NoSuchElementException ClassThrown by various accessor methods to indicate that the element being requested does not exist.
Java Optional ClassA container object which may or may not contain a non-null value.
Java OptionalDouble ClassA container object which may or may not contain a double value.
Java OptionalInt ClassA container object which may or may not contain an int value.
Java OptionalLong ClassA container object which may or may not contain a long value.
Java PriorityQueue ClassProvides an unbounded priority queue based on a priority heap.
Java Properties ClassRepresents a persistent set of properties which can be loaded and saved from/to a stream.
Java SequencedCollection InterfaceRepresents a collection that maintains the order of elements.
Java SequencedMap InterfaceRepresents a map that maintains the order of entries.
Java SequencedSet InterfaceRepresents a set that maintains the order of elements.
Java Set InterfaceRepresents a collection that contains no duplicate elements.
Java SortedMap InterfaceRepresents a map that maintains its entries in ascending order of keys.
Java SortedSet InterfaceRepresents a set that maintains its elements in ascending order.
Java Spliterator InterfaceProvides an object for traversing and partitioning elements of a source.
Java Stack ClassRepresents a last-in-first-out (LIFO) stack of objects.
Java StringJoiner ClassProvides 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 ClassProvides a way to break a string into tokens.
Java UUID ClassRepresents an immutable universally unique identifier (UUID).
Java WeakHashMap ClassImplements a hash table with weak keys, allowing entries to be garbage-collected when their keys are no longer in ordinary use.
Java Calendar ClassProvides methods for converting between a specific instant in time and a set of calendar fields.
Java Base64 ClassProvides methods for encoding and decoding using the Base64 encoding scheme.
Java ConcurrentModificationExceptionThrown when a method detects concurrent modification of an object when such modification is not permissible.
Java Comparator InterfaceDefines a method for comparing two objects for order.
Java Currency ClassRepresents a currency.
Java Scanner ClassProvides methods for parsing primitive types and strings using regular expressions.

Java Util Function Package – Classes and Interfaces

Class/InterfaceDescription
Java FunctionRepresents a function that accepts one argument and produces a result.
Java PredicateRepresents a predicate (boolean-valued function) of one argument.
Java SupplierRepresents a supplier of results.
Java ConsumerRepresents an operation that accepts a single input argument and returns no result.
Java BiFunctionRepresents a function that accepts two arguments and produces a result.
Java BinaryOperatorRepresents an operation upon two operands of the same type, producing a result of the same type as the operands.
Java BiConsumerRepresents an operation that accepts two input arguments and returns no result.
Java IntConsumerRepresents an operation that accepts a single int-valued argument and returns no result.
Java DoubleConsumerRepresents an operation that accepts a single double-valued argument and returns no result.
Java LongConsumerRepresents an operation that accepts a single long-valued argument and returns no result.
Java IntFunctionRepresents a function that accepts an int-valued argument and produces a result.
Java LongFunctionRepresents a function that accepts a long-valued argument and produces a result.
Java IntPredicateRepresents a predicate (boolean-valued function) of one int-valued argument.
Java LongPredicateRepresents a predicate (boolean-valued function) of one long-valued argument.
Java ToDoubleFunctionRepresents a function that produces a double-valued result.
Java ToIntFunctionRepresents a function that produces an int-valued result.
Java ToLongFunctionRepresents a function that produces a long-valued result.
Java IntSupplierRepresents a supplier of int-valued results.
Java DoubleSupplierRepresents a supplier of double-valued results.
Java BiPredicateRepresents a predicate (boolean-valued function) of two arguments.
Java BooleanSupplierRepresents a supplier of boolean-valued results.
Java IntBinaryOperatorRepresents an operation upon two int-valued operands, producing an int-valued result.
Java DoubleBinaryOperatorRepresents an operation upon two double-valued operands, producing a double-valued result.
Java LongBinaryOperatorRepresents an operation upon two long-valued operands, producing a long-valued result.
Java IntToDoubleFunctionRepresents a function that accepts an int-valued argument and produces a double-valued result.
Java IntToLongFunctionRepresents a function that accepts an int-valued argument and produces a long-valued result.
Java LongToDoubleFunctionRepresents a function that accepts a long-valued argument and produces a double-valued result.
Java LongToIntFunctionRepresents a function that accepts a long-valued argument and produces an int-valued result.
Java DoubleToIntFunctionRepresents a function that accepts a double-valued argument and produces an int-valued result.
Java DoubleToLongFunctionRepresents a function that accepts a double-valued argument and produces a long-valued result.
Java ObjDoubleConsumerRepresents an operation that accepts an object-valued and a double-valued argument and returns no result.
Java ObjIntConsumerRepresents an operation that accepts an object-valued and an int-valued argument, and returns no result.
Java ObjLongConsumerRepresents an operation that accepts an object-valued and a long-valued argument and returns no result.
Java ToDoubleBiFunctionRepresents a function that accepts two arguments and produces a double-valued result.
Java ToIntBiFunctionRepresents a function that accepts two arguments and produces an int-valued result.
Java ToLongBiFunctionRepresents a function that accepts two arguments and produces a long-valued result.
Java UnaryOperatorRepresents an operation on a single operand that produces a result of the same type as its operand.
Java IntUnaryOperatorRepresents an operation on a single int-valued operand that produces an int-valued result.
Java DoubleUnaryOperatorRepresents an operation on a single double-valued operand that produces a double-valued result.
Java LongUnaryOperatorRepresents an operation on a single long-valued operand that produces a long-valued result.

Java Stream Package – Classes and Interfaces

Class/InterfaceDescription
Java StreamRepresents a sequence of elements supporting sequential and parallel aggregate operations.
Java CollectorsProvides implementations of reduction operations, such as accumulating elements into collections, summarizing elements according to various criteria, etc.
Java IntStreamRepresents a sequence of primitive int-valued elements supporting sequential and parallel aggregate operations.
Java DoubleStreamRepresents a sequence of primitive double-valued elements supporting sequential and parallel aggregate operations.
Java StreamSupportProvides utility methods for creating and manipulating streams.

Java Time Package – Classes and Interfaces

Class/InterfaceDescription
Java LocalDateRepresents a time (hour, minute, second, nanosecond) without a time zone.
Java LocalDateTimeRepresents a date-time without a time-zone in the ISO-8601 calendar system, such as 2007-12-03T10:15:30.
Java LocalTimeRepresents a time (hour, minute, second, nanosecond) without a time-zone.
Java InstantRepresents a specific moment in time, typically represented as a number of seconds and nanoseconds since the epoch of 1970-01-01T00:00:00Z.
Java OffsetDateTimeRepresents 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 OffsetTimeRepresents a time with an offset from UTC/Greenwich in the ISO-8601 calendar system, such as 10:15:30+01:00.
Java ZonedDateTimeRepresents 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 YearRepresents a year in the ISO-8601 calendar system.
Java YearMonthRepresents a year-month in the ISO-8601 calendar system, such as 2007-12.
Java PeriodRepresents a date-based amount of time in the ISO-8601 calendar system, such as ‘2 years, 3 months and 4 days’.
Java DurationRepresents a time-based amount of time, such as ‘34.5 seconds’.
Java DayOfWeekRepresents a day-of-week, such as ‘Tuesday’.
Java MonthRepresents a month-of-year, such as ‘July’.
Java MonthDayRepresents a month-day in the ISO-8601 calendar system, such as ‘–12-03’.
Java ClockProvides access to the current instant, date, and time using a time zone.
Java ZoneIdRepresents a time-zone identifier, such as ‘Europe/Paris’.
Java ZoneOffsetRepresents a time-zone offset from UTC/Greenwich.
Java DateTimeExceptionThrown to indicate a problem while calculating or converting a date-time.
Java DateTimeFormatterProvides a way to print and parse date-time objects.

Commonly Used Java Methods/APIs

Java Lang Package – Important Classes and its Methods/APIs

ClassDescription
Java String Class MethodsProvides methods to manipulate and handle string data.
Java Object Class MethodsDefines the root class of the Java class hierarchy.
Java Integer Class MethodsProvides methods for converting int values and working with Integer objects.
Java Double Class MethodsIt provides methods for converting double values and working with double objects.
Java Long Class MethodsIt provides methods for converting long values and working with long objects.
Java Boolean Class MethodsProvides methods for converting boolean values and working with Boolean objects.
Java Character Class MethodsProvides methods for working with char values.
Java Short Class MethodsIt provides methods for converting short values and working with short objects.
Java Byte Class MethodsProvides methods for converting byte values and working with Byte objects.
Java Class MethodsProvides methods for working with Java class objects.
Java Thread Class MethodsProvides methods for managing and controlling threads.
Java Math Class MethodsProvides methods for performing basic numeric operations.
Java System Class MethodsProvides access to system-related resources and properties.
Java Package Class MethodsProvides methods to get information about the implementation and specification of a package.
Java ThreadLocal Class MethodsProvides thread-local variables.
Java ThreadGroup Class MethodsProvides methods for managing groups of threads.
Java Throwable Class MethodsProvides methods for handling exceptions and errors.
Java Enum Class MethodsProvides methods for working with enum types.
Java CompletableFuture MethodsProvides methods for asynchronous programming.
Java Executors Class MethodsProvides factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory, and Callable classes.
Java ThreadPoolExecutor Class MethodsProvides methods for managing a pool of threads.
Java StringBuilder MethodsProvides methods for manipulating the sequence of characters.
Java StringTemplate Class MethodsProvides methods for template-based string operations.

Java Util Package – Important Classes and their Methods/APIs

ClassDescription
Java ArrayList Class MethodsProvides methods for managing dynamic arrays.
Java HashMap Class MethodsProvides methods for managing hash tables and key-value pairs.
Java Scanner Class MethodsProvides methods for parsing primitive types and strings using regular expressions.
Java LinkedList Class MethodsProvides methods for managing linked lists.
Java HashSet Class MethodsProvides methods for managing sets backed by a hash table.
Java LinkedHashSet Class MethodsProvides methods for managing linked hash sets.
Java CopyOnWriteArraySet Class MethodsProvides methods for managing thread-safe sets where elements cannot be changed once added.
Java PriorityQueue Class MethodsProvides methods for managing priority queues.
Java EnumSet Class MethodsProvides methods for managing sets of enum types.
Java LinkedHashMap Class MethodsProvides methods for managing linked hash maps.
Java TreeMap Class MethodsProvides methods for managing maps sorted according to the natural ordering of its keys.
Java EnumMap Class MethodsProvides methods for managing specialized maps with enum keys.
Java ConcurrentHashMap Class MethodsProvides methods for managing thread-safe hash tables.
Java CopyOnWriteArrayList Class MethodsProvides methods for managing thread-safe lists where elements cannot be changed once added.
Java Stack Class MethodsProvides methods for managing last-in-first-out (LIFO) stacks.
Java Currency Class MethodsProvides methods for working with currency values.
Java Objects Class MethodsProvides methods for working with objects and performing operations such as comparisons and null checks.

Java Util Function Package – Important Classes and their Methods/APIs

ClassDescription
Java Stream MethodsProvides methods for working with streams, allowing functional-style operations on sequences of elements.
Java Collectors Class MethodsProvides implementations of reduction operations, such as accumulating elements into collections.
Java IntStream MethodsProvides methods for working with streams of primitive int values.
Java LongStream MethodsProvides methods for working with streams of primitive long values.
Java DoubleStream MethodsProvides methods for working with streams of primitive double values.

Java Time Package – Important Classes and their Methods/APIs

ClassDescription
Java LocalDate Class MethodsProvides methods for working with times (hour, minute, second, nanosecond) without a time zone.
Java LocalTime Class MethodsProvides methods for working with times (hour, minute, second, nanosecond) without a time-zone.
Java LocalDateTime Class MethodsProvides methods for working with date times without a time zone.
Java ZonedDateTime Class MethodsProvides methods for working with date times with a time zone.
Java Instant Class MethodsProvides methods for working with a specific moment in time.
Java Duration Class MethodsProvides methods for working with time-based amounts of time.
Java Clock Class MethodsProvides methods for accessing the current instant, date, and time using a time zone.
Scroll to Top