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
Popular Java guides
Most readLatest Java guides
Page 102 of 109Java Arithmetic Operators: Syntax, Precedence, and Edge Cases
java arithmetic operators: Understand Java arithmetic operators, including precedence, type promotion, and common edge cases like overflow and division by zero.
Java ClassCastException: Causes and Fixes
Understand why ClassCastException occurs in Java, how type erasure and unchecked casts cause it, and how to prevent it with generics and instanceof.
Java instanceof Pattern Matching: Syntax and Scope
Java instanceof pattern matching removes redundant casts. This article explains the syntax, flow scoping rules, record patterns, and pattern matching for switch.
Java instanceof Operator: Syntax and Pattern Matching
Learn how the Java instanceof operator works, including pattern matching, inheritance, null handling, and when to use getClass() or Class.isInstance().
Java Upcasting vs Downcasting: Key Differences
java upcasting vs downcasting: Understand Java upcasting vs downcasting: how they work, when to use them, and how to avoid ClassCastException in your code.
Java Downcasting: Syntax, Risks, and Safe Usage
Understand Java downcasting: syntax, when it is safe, the ClassCastException risk, instanceof guards, and pattern matching alternatives for cleaner code.
Java Upcasting: Parent Type References Explained
Understand Java upcasting: how a subclass object can be treated as a parent type, what it enables, and where it can limit your code.
Java Object Casting: Upcasting, Downcasting, and Safety
Learn how Java object casting works: the difference between upcasting and downcasting, when ClassCastException occurs, and how instanceof and pattern matching make type conversion safer.
Java int to char: Conversion and Pitfalls
java int to char: Java int to char conversion involves direct casting, which interprets the int as a Unicode code point. Understand behavior, pitfalls, and when to use...
Convert java char to int
Learn how to convert a Java char to an int, including digit-value extraction, Unicode behavior, and common pitfalls.