JVM architecture
27 questions in 7 subtopics.
JVM components
Describe the main components of the JVM and the runtime data areas it uses.Explain class loading in Java 9 and later: the built-in class loaders, delegation, and the phases a class goes through before use.A long-running service fails withOutOfMemoryError: Metaspace after a few days, and another logs CodeCache is full. Compiler has been disabled. Explain each and how you would investigate.Your organisation runs Java services on several JDK distributions and versions. How would you choose and standardise JDK distribution and version policy across the fleet?The JVM separates the language from a verified bytecode format that is executed by an interpreter and JIT compilers. Why has this design helped Java last about 30 years, and what does it mean for bets on alternatives such as native images or WebAssembly?Bytecode and the class file
What is in a Java class file, and what doesUnsupportedClassVersionError: class file version 65.0 mean?How do string concatenation like "a" + x + "b" and a lambda like list.forEach(s -> print(s)) compile in modern Java? What does javap show?Frameworks like Spring, Hibernate and Mockito generate or modify bytecode at runtime. Explain why and how, and what the Class-File API in Java 24 changes.Your shared libraries must support services on Java 17, 21 and 25. How do you decide the bytecode baseline, and what options exist to use newer APIs where available?Interpreter and JIT
A Java service is slow for its first minutes after each deployment and then becomes fast without any change in load. What happens inside HotSpot during that time, and what does it mean for deployments and benchmarks?Name the JIT optimisations that matter most for Java performance and the code patterns that defeat them.A colleague benchmarks two implementations withlong start = System.nanoTime();
for (int i = 0; i < 1000; i++) compute(i);
HotSpot
Java 25 made compact object headers a product feature (JEP 519). What are object headers, and what would you check before turning compact headers on for a service?What are the main garbage collectors in HotSpot as of Java 25, and how would you choose among them for a service?Teams copy JVM flags from blog posts and old services, so your fleet has hundreds of different flag combinations. How would you standardise JVM configuration?Over the next five to ten years, should your organisation bet on HotSpot JIT, GraalVM Native Image, or a mix for its Java services? Explain the trade-offs you would weigh.JVM languages
Name some JVM languages, explain how they run on the JVM, and what invokedynamic added for them.A team wants to write new Spring Boot services in Kotlin while the rest of the organisation uses Java. What technical issues should they plan for?Some teams want to use Kotlin or Scala alongside Java. As the architecture lead, would you allow multiple JVM languages, and under what conditions?Java moved to six-month releases in 2018 and has since added records, pattern matching, sealed classes and virtual threads. How does this change the long-term case for adopting other JVM languages in a large organisation?Java launcher, classpath and system properties
Explain how the java launcher finds classes and configuration: the -cp option and its wildcard form, the CLASSPATH variable, -D system properties,JAVA_TOOL_OPTIONS, and @argument files. Which value wins when several are set?In production a service throws NoSuchMethodError on a Jackson method that exists in the version declared in the build. Locally it works. How do you find which jar the class was loaded from and fix the class path problem?Across 200 services, JVM options and system properties are set in Dockerfiles, Helm charts, start scripts and JAVA_TOOL_OPTIONS by different teams, causing incidents. Design how JVM launch configuration should be managed.JDK command-line tools: jshell, javadoc, jar, jdeps
Give a practical use for each of these JDK tools in a Java project: jshell, javadoc, jar and jdeps. Show one command for each.You must upgrade a legacy application from Java 8 to Java 25 and build a small container image. How would you use jdeps and jlink in this work, and what problems do they reveal?The JDK has shipped tools like javadoc and jar since Java 1.0 and added jshell, jlink and jdeps much later, while most teams use build tools and IDEs instead. As the senior technical leader, how much should your engineering organisation invest in JDK tool skills and standard tooling?No question matches these choices.