Java Articles

All articles

NegativeArraySizeException in Java — What It Means and How to Fix It

What Java's NegativeArraySizeException means and how to fix it.

InterruptedException in Java — What It Means and How to Fix It

What Java's InterruptedException means and how to fix it.

NoClassDefFoundError in Java — What It Means and How to Fix It

What Java's NoClassDefFoundError means and how to fix it.

ClassNotFoundException in Java — What It Means and How to Fix It

What Java's ClassNotFoundException means and how to fix it.

NoSuchElementException in Java — What It Means and How to Fix It

What Java's NoSuchElementException means and how to fix it.

UnsupportedOperationException in Java — What It Means and How to Fix It

What Java's UnsupportedOperationException means and how to fix it.

IllegalStateException in Java — What It Means and How to Fix It

What Java's IllegalStateException means and how to fix it.

IllegalArgumentException in Java — What It Means and How to Fix It

What Java's IllegalArgumentException means and how to fix it.

OutOfMemoryError in Java — What It Means and How to Fix It

What Java's OutOfMemoryError means and how to fix it.

StackOverflowError in Java — What It Means and How to Fix It

What Java's StackOverflowError means and how to fix it.

ArithmeticException in Java — What It Means and How to Fix It

What Java's ArithmeticException means and how to fix it.

NumberFormatException in Java — What It Means and How to Fix It

What Java's NumberFormatException means and how to fix it.

ConcurrentModificationException in Java — What It Means and How to Fix It

What Java's ConcurrentModificationException means and how to fix it.

ClassCastException in Java — What It Means and How to Fix It

What Java's ClassCastException means and how to fix it.

ArrayIndexOutOfBoundsException in Java — What It Means and How to Fix It

What Java's ArrayIndexOutOfBoundsException means and how to fix it.

NullPointerException in Java — What It Means and How to Fix It

What Java's NullPointerException means and how to fix it.

ArrayList vs LinkedList in Java — Performance and When to Use Each

ArrayList offers fast random access backed by an array; LinkedList offers fast insertion/removal at the ends backed by nodes. Learn the real tradeoffs.

Interface vs Abstract Class in Java — When to Use Each

An interface defines a contract any class can implement; an abstract class provides shared state and partial implementation for related subclasses.

Checked vs Unchecked Exceptions in Java

Checked exceptions must be declared or caught at compile time; unchecked exceptions (RuntimeException) don't require handling. Learn when to use each.

equals() and hashCode() in Java — Why You Must Override Both

Overriding equals() without hashCode() breaks HashMap and HashSet behavior. Learn the contract between them and why they must be consistent.

String vs StringBuilder in Java — Which Should You Use?

Java Strings are immutable, so repeated concatenation creates many objects; StringBuilder mutates a buffer in place for far better performance in loops.