Questions
Java questions
Choose a question page, learn the concept, then test your understanding with a quiz.
How to Declare and Initialize an Array in Java
Learn how to declare and initialize arrays in Java with simple examples, syntax, common mistakes, and practical use cases.
How to Deserialize a JSON Array of Objects with Jackson in Java
Learn how to deserialize a JSON array of objects into Java arrays or List<MyClass> using Jackson with clear examples and common pitfalls.
How to Download a File in Android and Show Progress in a ProgressDialog
Learn how to download a file in Android and update a ProgressDialog with download progress using beginner-friendly Java examples.
How to Fix "No Main Manifest Attribute" in a JAR File (Java)
Learn what "no main manifest attribute" means in Java, why it happens, and how to inspect or run a JAR correctly.
How to Fix Eclipse Exit Code 13: 32-bit vs 64-bit Java on Windows
Learn why Eclipse returns exit code 13 on Windows and how to fix Java bit-version mismatches, javaw.exe path issues, and VM settings.
How to Fix Jackson Unrecognized field Error in Java JSON Mapping
Learn why Jackson throws 'Unrecognized field' in Java and how to map JSON field names correctly with wrapper objects and annotations.
How to Fix NetworkOnMainThreadException in Android (Java)
Learn why Android throws NetworkOnMainThreadException and how to fix it using background threads for network requests in Java.
How to Fix UnsupportedClassVersionError in Java: JRE vs JDK and Version Mismatch
Learn why Java UnsupportedClassVersionError happens, how JRE and JDK differ, and how to fix class version mismatches correctly.
How to Fix javax.xml.bind.JAXBException NoClassDefFoundError in Java 9+
Learn why JAXB is missing in Java 9+ and how to fix javax.xml.bind.JAXBException NoClassDefFoundError with modules or dependencies.
How to Generate a Random Alphanumeric String in Java
Learn how to generate random alphanumeric strings in Java with flexible length, practical examples, uniqueness tips, and common mistakes.
How to Generate an MD5 Hash in Java
Learn how to generate an MD5 hash in Java using MessageDigest, convert bytes to hex, and understand when MD5 should and should not be used.
How to Get the Current Stack Trace in Java
Learn how to get the current stack trace in Java, return it as data, and use StackTraceElement safely in logging and debugging.
How to Get the Current Working Directory in Java
Learn how Java gets the current working directory, why user.dir may show system32, and how to resolve file paths correctly.
How to Initialize a HashMap in Java: Literal-Like Syntax and Best Practices
Learn how to initialize a Java HashMap with fixed values, why Java has no map literal syntax, and the best modern alternatives.
How to Initialize a Static Map in Java
Learn how to initialize a static Map in Java, including static blocks, double-brace initialization, Map.of, and best practices.
How to Install and Configure Java 8 on Mac
Learn how Java 8 is installed on macOS, why JDK paths differ, and how to verify and configure the correct Java version.
How to Iterate Over a Java Map Efficiently
Learn the most efficient ways to iterate over a Java Map, when to use entrySet, and how ordering depends on the Map implementation.
How to Iterate Through a HashMap in Java
Learn the best ways to iterate through a HashMap in Java, with examples using entrySet, keySet, values, and forEach.
How to Join Two Lists in Java Without Modifying the Originals
Learn how to join two lists in Java using JDK-only approaches, including addAll, streams, and older Java-compatible techniques.
How to Left Pad Integers with Leading Zeros in Java
Learn how to pad integers with leading zeros in Java using String.format and DecimalFormat with clear examples and common mistakes.