| 1 | What are the eight primitive data types in Java, and how do they differ fundamentally from reference types like String or a custom class? Java › Java Fundamentals: Syntax, Data Types & Operators | Java | Java Fundamentals: Syntax, Data Types & Operators | Beginner |
| 2 | What is the difference between the ++ (increment) and -- (decrement) operators used in prefix versus postfix position, and what subtle bug can arise from using them within a complex expression? Java › Java Fundamentals: Syntax, Data Types & Operators | Java | Java Fundamentals: Syntax, Data Types & Operators | Intermediate |
| 3 | How does Java's short-circuit evaluation for && and || operators differ from the non-short-circuiting & and | operators when applied to boolean operands, and why does this distinction matter for avoiding NullPointerException? Java › Java Fundamentals: Syntax, Data Types & Operators | Java | Java Fundamentals: Syntax, Data Types & Operators | Intermediate |
| 4 | How does Java's implicit numeric type promotion and narrowing/widening conversion rules work, and what specific data-loss or precision risks does an implicit narrowing conversion (requiring an explicit cast) guard against? Java › Java Fundamentals: Syntax, Data Types & Operators | Java | Java Fundamentals: Syntax, Data Types & Operators | Advanced |
| 5 | How does Java's String immutability, combined with the string pool, interact with security-sensitive code (like handling passwords), and why is char[] generally recommended over String for storing sensitive data temporarily in memory? Java › Java Fundamentals: Syntax, Data Types & Operators | Java | Java Fundamentals: Syntax, Data Types & Operators | Advanced |
| 6 | How does Java's compound assignment operator (like +=) implicitly include a narrowing cast that a corresponding explicit expanded assignment (x = x + y) does not, and what surprising behavior results from this? Java › Java Fundamentals: Syntax, Data Types & Operators | Java | Java Fundamentals: Syntax, Data Types & Operators | Advanced |
| 7 | What is the difference between the == operator and the .equals() method when comparing two custom objects, if the class hasn't overridden equals()? Java › Java Fundamentals: Syntax, Data Types & Operators | Java | Java Fundamentals: Syntax, Data Types & Operators | Beginner |
| 8 | How does Java's operator precedence and associativity determine the evaluation order of a complex expression, and what are some common precedence-related mistakes? Java › Java Fundamentals: Syntax, Data Types & Operators | Java | Java Fundamentals: Syntax, Data Types & Operators | Intermediate |
| 9 | What is the difference between the == operator and the .equals() method when comparing String objects, and why does String's string pool (interning) behavior sometimes make == appear to 'work' for strings? Java › Java Fundamentals: Syntax, Data Types & Operators | Java | Java Fundamentals: Syntax, Data Types & Operators | Intermediate |
| 10 | What is the difference between a Java text block (introduced as a standard feature in Java 15) and a traditional String literal, and what specific syntax rules govern indentation handling? Java › Java Fundamentals: Syntax, Data Types & Operators | Java | Java Fundamentals: Syntax, Data Types & Operators | Intermediate |
| 11 | What is the difference between a compile-time constant expression and a regular final variable, and why does this distinction matter for switch statement case labels and certain compiler optimizations? Java › Java Fundamentals: Syntax, Data Types & Operators | Java | Java Fundamentals: Syntax, Data Types & Operators | Intermediate |
| 12 | What is the difference between an instance initializer block and a static initializer block, and when does each execute relative to a class's constructors? Java › Java Fundamentals: Syntax, Data Types & Operators | Java | Java Fundamentals: Syntax, Data Types & Operators | Intermediate |
| 13 | How does Java's autoboxing and unboxing mechanism work at the bytecode level, and what specific performance and correctness pitfalls does it introduce in seemingly innocuous code, such as within a loop? Java › Java Fundamentals: Syntax, Data Types & Operators | Java | Java Fundamentals: Syntax, Data Types & Operators | Advanced |
| 14 | How does the var keyword (local variable type inference, introduced in Java 10) work, and what specific restrictions apply to where it can and cannot be used, given Java remains a statically-typed language? Java › Java Fundamentals: Syntax, Data Types & Operators | Java | Java Fundamentals: Syntax, Data Types & Operators | Advanced |
| 15 | How does Java's integer division and modulo operator behave with negative operands, and how does this differ from the mathematical definition of modulo used in some other contexts (like array indexing wraparound)? Java › Java Fundamentals: Syntax, Data Types & Operators | Java | Java Fundamentals: Syntax, Data Types & Operators | Advanced |
| 16 | How do you declare and initialize an array of objects (reference types) versus an array of primitives, and what is the key difference in their default values? Java › Arrays & Multidimensional Arrays | Java | Arrays & Multidimensional Arrays | Beginner |
| 17 | What is the relationship between equals() and the == operator when comparing primitive types versus reference types, and how does this affect comparing boxed wrapper types like Integer? Java › equals(), hashCode() & toString() Contracts | Java | equals(), hashCode() & toString() Contracts | Intermediate |
| 18 | What is the multi-catch syntax (catch (IOException | SQLException e)) introduced in Java 7, and what restriction applies to the exception types combined in a single multi-catch block? Java › Exceptions | Java | Exceptions | Intermediate |
| 19 | How do you overload arithmetic operators like + and - using __add__ and __sub__? Python › Magic Methods & Operator Overloading | Python | Magic Methods & Operator Overloading | Intermediate |
| 20 | What are annotations in Java, and what purpose do they serve? Java › Annotations | Java | Annotations | Beginner |
| 21 | How do you declare, initialize, and access elements of a one-dimensional array in Java? Java › Arrays & Multidimensional Arrays | Java | Arrays & Multidimensional Arrays | Beginner |
| 22 | What problem do build tools like Maven and Gradle solve for a Java project? Java › Build Tools: Maven & Gradle | Java | Build Tools: Maven & Gradle | Beginner |
| 23 | What is the standard Maven directory layout, and why does following this convention matter? Java › Build Tools: Maven & Gradle | Java | Build Tools: Maven & Gradle | Beginner |
| 24 | What is an enum in Java, and how does it differ from simply using a set of integer or String constants? Java › Enums | Java | Enums | Beginner |
| 25 | What is the difference between checked and unchecked exceptions in Java, and how does the compiler treat each differently? Java › Exceptions | Java | Exceptions | Beginner |
| 26 | What is the basic syntax and control flow of a try-catch-finally block, and what determines which catch block (if multiple exist) handles a thrown exception? Java › Exceptions | Java | Exceptions | Beginner |
| 27 | What is the difference between byte streams (InputStream/OutputStream) and character streams (Reader/Writer) in the classic java.io package? Java › I/O & NIO | Java | I/O & NIO | Beginner |
| 28 | How do you read all bytes or all lines of a small-to-medium text file in a single, concise call using modern NIO.2 utility methods? Java › I/O & NIO | Java | I/O & NIO | Beginner |
| 29 | How do you instantiate a non-static inner class from OUTSIDE the enclosing class (from a different class entirely), and what is the exact syntax required? Java › Inner Classes & Anonymous Classes | Java | Inner Classes & Anonymous Classes | Beginner |
| 30 | Can an interface declare instance fields, and if so, what implicit modifiers are automatically applied to any field declared in an interface? Java › Interfaces & Abstract Classes | Java | Interfaces & Abstract Classes | Beginner |
| 31 | How do annotations with elements (parameters) work, including default values and the special `value` element? Java › Annotations | Java | Annotations | Intermediate |
| 32 | What is the difference between the @Nullable/@NonNull annotations (from libraries like JetBrains or JSR-305) and Java's built-in Optional type for expressing nullability? Java › Annotations | Java | Annotations | Intermediate |
| 33 | How do multidimensional arrays work in Java, and how do they differ from truly rectangular arrays in languages like C? Java › Arrays & Multidimensional Arrays | Java | Arrays & Multidimensional Arrays | Intermediate |
| 34 | How do you correctly iterate a 2D array using both traditional indexed for-loops and the enhanced for-each loop, and when is each approach preferable? Java › Arrays & Multidimensional Arrays | Java | Arrays & Multidimensional Arrays | Intermediate |
| 35 | How does Gradle's build script (build.gradle / build.gradle.kts) differ structurally from Maven's declarative XML pom.xml? Java › Build Tools: Maven & Gradle | Java | Build Tools: Maven & Gradle | Intermediate |
| 36 | How do you configure the Maven Compiler Plugin to target a specific Java language version, and what's the difference between source, target, and release configuration? Java › Build Tools: Maven & Gradle | Java | Build Tools: Maven & Gradle | Intermediate |
| 37 | What are the immutable collection factory methods (List.of(), Set.of(), Map.of()) introduced in Java 9, and how do they differ from Collections.unmodifiableList()? Java › Collections Framework | Java | Collections Framework | Intermediate |
| 38 | How do you correctly use an enum as a switch statement/expression's target, and what changed with the introduction of arrow-style switch expressions (Java 14+) regarding exhaustiveness and fall-through? Java › Enums | Java | Enums | Intermediate |
| 39 | How would you use an enum to represent a fixed set of configuration keys combined with a shared lookup method, avoiding scattered String literal keys throughout a codebase? Java › Enums | Java | Enums | Intermediate |
| 40 | How does Objects.equals() and Objects.hash() from java.util.Objects simplify writing correct equals() and hashCode() implementations, particularly regarding null-safety? Java › equals(), hashCode() & toString() Contracts | Java | equals(), hashCode() & toString() Contracts | Intermediate |
| 41 | How does a local or anonymous class defined inside a static method or static context differ from one defined inside an instance method, regarding what enclosing state it can access? Java › Inner Classes & Anonymous Classes | Java | Inner Classes & Anonymous Classes | Intermediate |
| 42 | How would you access the enclosing outer class's instance from within a nested inner class when there's a naming conflict (like a shadowed field with the same name), using the OuterClassName.this syntax? Java › Inner Classes & Anonymous Classes | Java | Inner Classes & Anonymous Classes | Intermediate |
| 43 | How would you calculate the difference between two dates or times using Period and Duration, and what's the distinction between these two classes? Java › Java Date & Time API (java.time) | Java | Java Date & Time API (java.time) | Intermediate |
| 44 | How do you parse and format date/time values using DateTimeFormatter, and how does this replace the older, notoriously thread-unsafe SimpleDateFormat class? Java › Java Date & Time API (java.time) | Java | Java Date & Time API (java.time) | Intermediate |
| 45 | How would you determine whether a given year is a leap year, and calculate the number of days in a specific month, using the java.time API's built-in support rather than hand-writing this classic calendrical logic? Java › Java Date & Time API (java.time) | Java | Java Date & Time API (java.time) | Intermediate |
| 46 | How would you write and run a basic 'Hello World' JPMS-modularized application from scratch, including the module-info.java, directory structure, and the specific javac/java command-line invocations needed? Java › Java Platform Module System (JPMS) | Java | Java Platform Module System (JPMS) | Intermediate |
| 47 | How do type annotations (introduced in Java 8, JSR 308) differ from traditional declaration annotations, and what new locations can they target? Java › Annotations | Java | Annotations | Advanced |
| 48 | How would you implement a custom enum that also functions as a lookup table (mapping an external code to a constant), such as parsing an HTTP status code string into an enum constant, handling unknown values gracefully? Java › Enums | Java | Enums | Advanced |
| 49 | How does a lambda expression capture variables from its enclosing scope, and why must captured local variables be effectively final? Java › Functional Interfaces & Method References | Java | Functional Interfaces & Method References | Advanced |
| 50 | How does Java's type inference determine the target type for a lambda expression in an ambiguous overload scenario, and what happens when a lambda could match multiple overloaded methods accepting different functional interfaces? Java › Functional Interfaces & Method References | Java | Functional Interfaces & Method References | Advanced |
| 51 | How would you correctly handle character encoding when reading a text file whose encoding isn't known in advance (or might not be UTF-8), and what pitfalls exist with relying on the JVM's platform default charset? Java › I/O & NIO | Java | I/O & NIO | Advanced |