Browse by Topic

Popular

Latest

Latest Java Posts

Illustration of Java thread creation showing a main thread branching into multiple worker threads
Java

Creating Threads in Java: Runnable, Thread, and Executors

Learn how to create threads in Java using Thread subclasses, Runnable, lambdas, and ExecutorService, with guidance on choosing the right approach.

Java threadsRunnable interfaceExecutorServiceJava concurrency
Comparison of Java Thread class and Runnable interface for concurrent task execution
Java

Java Thread vs Runnable: Which to Use

Compare Java's Thread class and Runnable interface for defining concurrent tasks, and learn which approach fits different scenarios.

Java concurrencyThread classRunnable interfacemultithreading
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