Java’s Standard Libraries

Java’s Standard Library is vast and covers many areas of functionality that make Java a powerful and versatile language.

Library Purpose Key Classes Description
java.lang Core classes for basic functionality String, Math, Object, Thread, System Provides fundamental classes automatically imported into every Java program. Includes essential types like String, basic math, and system I/O.
java.util Utility classes for data structures, collections, and dates ArrayList, HashMap, HashSet, Date, Scanner Contains classes for working with data collections (like lists and maps) and utility classes like Scanner for input and Date for date handling.
java.io Input and output operations (file handling, streams) File, BufferedReader, FileInputStream Handles reading/writing data to/from files and streams. Includes character and byte streams for file I/O operations.
java.nio More efficient I/O operations, buffer management Path, Files, ByteBuffer, FileChannel Provides non-blocking I/O operations, for handling files and network communication with better performance using buffers and channels.
java.net Networking classes for communication over networks Socket, ServerSocket, URL, HttpURLConnection Facilitates network communication, providing classes for working with sockets, URLs, and making HTTP requests.
java.sql Database connectivity through JDBC Connection, Statement, ResultSet, DriverManager Used for connecting to relational databases and executing SQL queries.
java.time Date and time handling (modern API) LocalDate, LocalTime, Instant, Duration A modern API for working with date and time. It replaces older Date and Calendar classes and is immutable and thread-safe.
java.util.concurrent Utilities for multithreading and concurrency ExecutorService, CountDownLatch, ConcurrentHashMap Provides classes for managing concurrent tasks, synchronization, and thread-safe data structures.
javax.swing GUI components for desktop applications JFrame, JButton, JLabel, JPanel Enables building graphical user interfaces (GUIs) for desktop applications. Includes components for buttons, labels, windows, and containers.
java.security Security-related utilities MessageDigest, KeyPair, SecureRandom, Signature Provides cryptographic operations, secure random numbers, and digital signatures. Essential for encryption and secure communication.
java.rmi Remote Method Invocation for distributed computing Remote, Naming, Registry Allows invoking methods on objects running on different JVMs (remote communication).
javafx (optional) Rich desktop UI framework (separate from JDK in newer versions) Stage, Scene, Button, Label A modern GUI framework for building cross-platform desktop applications with advanced features like animations and effects.
java.util.zip Compression utilities (zip files) ZipInputStream, ZipOutputStream, GZIPInputStream For working with compressed files (e.g., .zip and .gzip formats) for reading and writing data in compressed formats.