Master the fundamental concepts of jvm internals through this focused micro-challenge.
\`javap -c\` disassembles \`.class\` files into JVM bytecode mnemonics. Every JDK ships it, and it is the first tool Java engineers use to verify what \`javac\` actually emitted.
Stack operations and calls dominate simple methods:
For example, \`System.out.println("hi")\` shows \`getstatic\` for the \`PrintStream\`, \`ldc\` for the string, then \`invokevirtual\` on \`println\`.
Verbose mode (\`javap -v\`) adds the constant pool, stack map tables, and line numbers for debugging.
Compare `javap -c` output before and after a one-line Java source change to see what javac actually altered. Optimizations like string concatenation lowering are visible only at bytecode level.
This exercise asks you to document sample \`javap -c\` output for a simple Java class. You will label opcodes and explain how source-level statements map to stack instructions.
You will use the same mental model here when reading production interpreter source later in the track. Sketch one concrete input on paper, predict the outcome, then confirm with code. That discipline catches logic errors early and makes debugging far faster when you extend the implementation in follow-on tasks.
Write a C program that documents javap output for a simple Java class.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github