Java

92 articles in this topic

Java Exception Handling Tutorial with Runnable Examples

Learn how Java moves control through try, catch, and finally, then build checked custom exceptions and safer file handling with runnable code.

Updated 5 Nov 20266 min readJava

Annotations in Java Tutorial: Custom Metadata, Retention and Reflection Examples

Create a custom Java annotation from zero, inspect its values through reflection, and learn how retention, targets and defaults control the result.

Updated 3 Nov 20265 min readJava

Collections Framework in Java: Interfaces, Implementations, and Examples

Learn how List, Set, Map, and Deque fit together, then choose implementations confidently through one consistent Java example.

Updated 2 Nov 20265 min readJava

JDBC in Java Tutorial: Connections, Queries and Transactions with Examples

Build and run one Java 17 program that creates an H2 table, inserts three products, filters them safely, then rolls back and commits two stock updates.

Updated 1 Nov 20266 min readJava

Inheritance in Java: Learn extends, super, and Overriding with Runnable Examples

Follow one runnable Vehicle and ElectricCar program to see inherited methods, constructor order, super calls, runtime dispatch, common errors, and practice tasks.

Updated 31 Oct 20266 min readJava

Encapsulation in Java: Build Safer Classes with Runnable Examples

Learn how a Java class can protect valid state through private fields, behaviour methods, validation before mutation, and defensive collection copies.

Updated 30 Oct 20265 min readJava

Operators in Java: Types, Precedence and Runnable Examples

Learn how Java evaluates arithmetic, assignment, unary, logical, bitwise and ternary operators through code and step-by-step output traces.

Updated 28 Oct 20266 min readJava

HashMap Internals in Java: Buckets, Collisions, Resizing and Treeification

Trace put() and get() from a key's hash code to its bucket, then see exactly how replacement, resizing, tree bins, and mutable keys behave.

Updated 27 Oct 20266 min readJava

Java Multithreading Basics: Threads, Runnable and Safe Counters with Examples

Build two Java thread examples, trace a lost counter update exactly, and learn when to use synchronized, AtomicInteger, volatile or private state.

Updated 30 Oct 20266 min readJava

Static and Final in Java: Shared State, Constants and Override Rules with Runnable Examples

Learn what static and final control in Java by tracing a shared counter, class initialisation, final references, constants and inheritance errors.

Updated 30 Oct 20266 min read52 viewsJava

Polymorphism in Java: Overloading, Overriding and Runnable Examples

Learn how Java chooses overloaded methods at compile time and overridden methods at runtime. Trace two complete programs, common traps and practice targets.

Updated 30 Oct 20266 min readJava

Packages and Access Modifiers in Java: Visibility Rules with Runnable Examples

Learn how Java package boundaries change member visibility. Compile a complete example covering public, protected, package-private and private access.

Updated 18 Oct 20265 min readJava