Diamond Operator in Java: Type Inference, Java 9 and var
Learn the diamond operator in Java with examples, raw type warnings, anonymous classes since Java 9, var pitfalls and type inference errors.
“Core Java” is Sun’s term, used to refer to Java SE, the standard edition and a set of related technologies, like the Java VM, CORBA, etc. This is mostly to differentiate from others like Java ME or Java EE. “Core Java” is Oracle’s definition and refers to subset of Java SE technologies.
The Core Java technologies and application programming interfaces (APIs) are the foundation of the Java Platform, Standard Edition (Java SE). They are used in all classes of Java programming, from desktop applications to Java EE applications.
Learn the diamond operator in Java with examples, raw type warnings, anonymous classes since Java 9, var pitfalls and type inference errors.
Java deep copy using in-memory serialization with a generic helper, shared references, transient fields, SerializationUtils, real cost and alternatives.
Learn how to print an array in Java with Arrays.toString() and deepToString(), why println shows [I@ codes, custom formats, records and char[] output.
Java serialization explained with Serializable, serialVersionUID, transient fields, records, readObject, Externalizable and deserialization filters.
Learn how double brace initialization in Java creates an anonymous class, why it leaks memory and breaks serialization, and what to use instead.
Method hiding in Java happens when a subclass redeclares a static method. See how it differs from overriding, the compiler rules and safer designs.
Java garbage collection algorithms explained for JDK 25 with mark-sweep, compact and copy, plus G1, ZGC, Shenandoah, Serial, Parallel, flags and GC logs.
Find duplicate words in a string in Java with Set, groupingBy() and merge(), ignore case and punctuation, find repeated words with regex and remove them.
Clone an object in Java with Cloneable and clone() or, better, with a copy constructor. Learn shallow vs deep copy, cloning arrays and collections, deep copies with serialization and Jackson, and why records need no cloning.
Java XPath tutorial with runnable examples of XPath syntax, data types, evaluateExpression, namespaces, variables, secure parsing and thread safety.
How to write custom exceptions in Java with cause constructors, a sealed hierarchy, context fields, JUnit tests and the common mistakes to avoid.
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.
Prepare Java String interview answers on immutability, equality, the pool, Unicode and coding tasks with nearby examples and clear limitations.
Sort a List in Java by natural order with Comparable or by any field with a Comparator. Compare List.sort, Collections.sort and Stream.sorted in code.
See how the ThreadPoolExecutor BlockingQueue decides when the pool grows, with SynchronousQueue, bounded and priority queues, sizing and rejected tasks.
Learn the difference between encapsulation and abstraction in Java with one thermostat example, a comparison table, getters, records and FAQs.
Learn the difference between an interface and abstract class in Java 25 with code, a comparison table, default methods, AbstractList and when to use each.
Abstraction in Java with interfaces, abstract classes and sealed interfaces, a CSV and JSON export example, a comparison table and common FAQs.
Deadlock in Java explained with a deterministic example, jstack and ThreadMXBean detection, lock ordering, tryLock timeouts and interruptible recovery.
Learn how HashMap works internally in Java with hashing, bucket index, collisions, Java 8 tree bins, resizing and why equal keys need equal hash codes.
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.