Compare Java Objects Without Getters: reflectionEquals()
Learn to compare Java objects without getters or equals() using EqualsBuilder.reflectionEquals(), excluded fields, recursive mode and AssertJ.
These java basic tutorials in intended for absolute beginners. If you are just beginning to learn java, you should go through these tutorials, otherwise skip them.
Learn to compare Java objects without getters or equals() using EqualsBuilder.reflectionEquals(), excluded fields, recursive mode and AssertJ.
Learn how Math.divideExact() in Java detects the Integer.MIN_VALUE / -1 overflow, how it handles zero, and how it compares to floorDivExact().
Java Math.abs() vs Math.absExact() with examples. Why Math.abs(Integer.MIN_VALUE) is negative, when absExact() throws, and safe alternatives.
To convert decimal to hexadecimal, divide by 16 repeatedly and read the remainders in reverse, so 269 becomes 10D. See a worked division table, a table of common conversion examples, and the Java one-liners for both directions.
Learn the builder pattern for Java records with a nested builder, Lombok @Builder and RecordBuilder, plus defaults, validation and with methods on Java 25.
The full list of Java keywords as of Java 25, with 51 reserved and 17 contextual keywords grouped by category, literals, version history and rules.
Convert an object to Map in Java with Jackson 3 convertValue(), JavaPropsMapper flat keys, Gson and reflection, plus nulls, records and Map back to object.
Learn how to round a double to 2 decimal places in Java with BigDecimal, Math.round(), String.format() and DecimalFormat, plus rounding modes and pitfalls.
Java printf examples for %s, %d, %.2f, width, flags, dates and locales, plus String.format(), formatted() and fixes for common format exceptions.
The ternary operator in Java with examples covering syntax, result types, the null unboxing trap, nested ternaries and when to use if-else instead.
Learn the Java Cleaner API with a native memory example, the mistakes that stop cleanup, and how to migrate deprecated finalize() code in Java 25.
Java tutorial for beginners on Java 25. Install the JDK, run a first program and follow a 12-step learning path plus an index of every Java topic.
Install Java on 64-bit Windows with JDK 25 using the MSI, ZIP or winget, set JAVA_HOME and Path, verify java -version and check 32-bit vs 64-bit.
Java Hello World program for Java 25 and older versions, with javac and java commands, real output, a line-by-line walkthrough and fixes for common errors.
Pattern matching for instanceof in Java with type patterns, flow scoping, null and generics rules, equals() examples, record patterns and Java 25 updates.
Java naming conventions for packages, classes, methods, variables, constants and generics, with identifier rules, examples, a refactoring and style guides.
Learn how Java hashCode and equals work, the contract between them, why HashSet breaks when only equals() is overridden, plus records and mutable keys.
Java wrapper classes explained with autoboxing and unboxing, valueOf() vs parseInt(), the Integer cache, == and null pitfalls, and examples on Java 25.
Java var keyword explained with Java 25 examples. See where local variable type inference works, which javac errors it causes, and common mistakes.
Java comments explained with single-line, multi-line and Javadoc examples, Markdown doc comments from Java 23, javadoc tags, shortcuts and good practice.
Java variables explained with examples of local, instance and static variables, default values, scope, var, final and naming rules in Java 25.
Learn the difference between JDK, JRE and JVM in Java 25, what each one contains, how class loaders and the JIT work and why Oracle ships no JRE.
Java modules tutorial for Java 25. Write module-info.java, use requires, exports, opens and services, fix module errors, and build with jlink.
JShell tutorial for Java 25. Run Java snippets without a class, use /vars, /list, /save and /open, add JARs, run scripts and learn the default imports.
Learn how the Java classpath works, set it with -cp or CLASSPATH on Windows and Linux, use lib/* wildcards, fix NoClassDefFoundError, compare sourcepath.
Java system properties in Java 25 with the standard key list, System.getProperty with defaults, -D options, setProperty and environment variables.
Static import in Java explained with single and on-demand forms, name clash and shadowing rules, JUnit examples, best practices and Java 25 compact files.
Learn the difference between a Java class and object, how to write a class, create objects with new, the initialization order and the kinds of classes.
A block statement in Java groups statements in braces. Learn block scope, the missing-brace bug, static and instance initializer blocks and labels.
Every type of statement in Java with a short example: declaration, expression, control flow, jump, block, empty, try, synchronized, labeled and assert statements, plus switch expressions, yield and pattern matching in switch.
Operators in Java with examples for arithmetic, logical, bitwise, assignment and instanceof operators, plus the precedence table and common traps.
Little endian vs big endian explained for Java developers. See Java’s default byte order and read little-endian data with ByteBuffer and reverseBytes().
Data types in Java with examples covering the 8 primitive types, sizes and ranges, reference types, literals, wrapper classes and choosing a type.
Introduction to Java programming language covering bytecode and the JVM, JDK vs JRE, Java 25 LTS, versions, features, uses and a first program to run.
Java has eight primitive data types that hold plain values, not object references. Sizes, ranges, defaults, literals, overflow, floating-point precision, casting rules and wrapper classes, with tested Java 25 examples.
java.exe vs javaw.exe on Windows, the console and GUI launchers compared, with output and exit codes, javaw.exe in Task Manager and when to use each.
Integer overflow in Java wraps values without an error. Detect it with Math.addExact, multiplyExact and toIntExact, and avoid it with long and BigInteger.
Use javap to view the bytecode of a Java class file. Learn -c, -p, -v and -l with real JDK 25 output, JAR classes, IDE viewers and the ClassFile API.
Java pass by value explained with primitives, object references, swap(), Strings, arrays and lists, plus how to return changed values from a method.
Java main method explained with the classic signature, Java 25 instance main methods, launcher errors, command-line arguments, parsing and exit codes.
Learn how to create an immutable class in Java with final fields, defensive copies and List.copyOf(), plus records, unmodifiable views and thread safety.
HowToDoInJava provides tutorials and how-to guides on Java and related technologies.
It also shares the best practices, algorithms & solutions and frequently asked interview questions.