Pages

Topics

Tools

↑↓navigate↵openescclose

Java guides

Every published Java guide, newest first, with practical examples you can copy into your own project.

3,965 guides across 14 topics

Topics

Latest Java guides

Illustration of a Java Runnable task being dispatched to worker threads in a thread pool.
Java

Java Runnable: Usage, Threads, and Executors

Learn how to use the Java Runnable interface with threads and executors, handle exceptions, and choose between Runnable and Callable.

RunnableConcurrencyThreadsExecutorService
Diagram of Java thread lifecycle states with arrows showing transitions between NEW, RUNNABLE, BLOCKED, WAITING, and TERMINATED.
Java

Java Thread Class: Creating and Managing Threads

java thread class: Learn how to create and manage threads with the Java Thread class, including lifecycle, synchronization, and common pitfalls.

JavaConcurrencyMultithreadingThread
Illustration of Java threads running concurrently with a lock symbol representing synchronization
Java

Java Threading: Creating and Managing Threads

Learn how to create and manage threads in Java with Thread, Runnable, and ExecutorService, plus practical tips for avoiding common concurrency issues.

java concurrencythreadexecutor servicesynchronization
A Java try-with-resources block automatically closing an I/O stream, representing resource management.
Java

Java Try-With-Resources for I/O: Syntax and Behavior

Java try-with-resources automatically closes I/O streams, handles multiple resources, and suppresses secondary exceptions. See syntax, examples, and custom AutoCloseable classes.

try-with-resourcesAutoCloseableresource managementI/O streams
Diagram comparing byte stream and character stream processing in Java
Java

Java Byte Streams vs Character Streams: Key Differences

Byte streams read raw bytes; character streams decode and encode text. Learn how charset encoding affects correctness and which stream type fits your Java file I/O task.

Java I/Obyte streamscharacter streamscharacter encoding
Java FileWriter writing text to a file with a character encoding symbol in the background.
Java

Java FileWriter: Writing Text Files with Character Encoding

Learn how to use Java FileWriter for writing text files, controlling encoding, managing resources, and choosing between FileWriter and BufferedWriter.

JavaFileWriterI/OCharacter Encoding
Illustration of Java FileReader reading characters from a text file with a BufferedReader for efficiency.
Java

Java FileReader: How to Read Text Files

Learn how to use Java FileReader to read character data from files, control encoding with charset-aware constructors, close resources, and improve performance with BufferedReader.

JavaFileReaderFile I/OCharacter Streams
Diagram showing Java BufferedWriter buffering text data before writing to a file, with a buffer and file icon.
Java

Using Java BufferedWriter for Efficient Text File Writing

When writing text to a file in Java, BufferedWriter reduces I/O overhead by collecting writes in an internal buffer. This guide covers creation, writing, flushing, closing, and exception handling.

Java I/OBufferedWriterFile WritingText Files
Illustration of a Java BufferedReader wrapping a file reader with a buffer, symbolizing efficient text input.
Java

Java BufferedReader: Efficient Text Reading

java bufferedreader: Learn how to use Java BufferedReader for efficient text input, covering creation, line reading, performance benefits, and resource management.

Java I/OBufferedReaderFile ReadingStreams
Illustration comparing Java OutputStream and Writer, showing byte and character streams diverging from a single data source.
Java

Java OutputStream vs Writer: Choosing the Right I/O API

Understand the difference between Java OutputStream and Writer, when to use each, and how character encoding affects text output.

Java I/OOutputStreamWriterCharacter Encoding