| Example | Since | Description |
|---|
| Add | | Add 2 ints together. Simple demonstration of stack machine. |
| Annotations | | Demonstrates annotations |
| Arrays | | Demonstrates array allocation in bytecode |
| Assert | | Demonstrates bytecode created by the assert keyword |
| CallPrivateMethod | | Compare the bytecode before and after Java 11. You will see the private method is called with invokespecial before Java 11 and invokevirtual in Java 11+ due to JEP 181 |
| ClassicSwitches | | Demonstrates the classic tableswitch and lookupswitch bytecode |
| ConstantOptimisation | | Shows that javac will perform simple mathematics on constants to reduce the bytecode |
| DeadCode | | Illustrates dead code elimination for static final guards |
| EnumSize | | Example of a Java enum |
| Erasure | | Demonstrates type erasure |
| Exceptions | | Demonstrates the MethodInfo exceptions table |
| Generics | | Shows how the class file captures generics information in the Signature attribute. |
| ImplicitConstructor | | Demonstrates the creation of a no-arg constructor method where instance fields are initialised |
| Increment | | Notice how only the int primitive type has an increment operation bytecode (IINC), the others all require 4-5 bytecode instructions to load, add, and store the new value. |
| InnerClasses | | Examples of inner classes |
| Loopy | | Explore the bytecode between different kinds of Java loop |
| MethodParameters | | Demonstrates passing method parameters |
| NoClass | 21 | Demonstrates implicitly declared classes and instance main methods JEP 463 |
| PersonRecord | 16 | Example of a Java record JEP 395 |
| PrimitiveSwitchExpressions | 23 | Demonstrates switch expressions on primitives JEP 455 |
| SealedAnimal | 18 | Example of sealed classes from JEP 409 |
| Shape | | Example of a Java interface with single implementation |
| StatementsBeforeSuper | 22 | Demonstrates statements before superclass constructor call JEP 447 |
| StaticInitialiser | | Demonstrstrates static initialisation code |
| StringTemplate | 21 | Demonstrates StringTemplate feature from JEP 430 |
| SwitchExpressions | 14 | Demonstrates switch expressions introduced by JEP 361 |
| Synchronized | | Demonstrates sychronized methods and blocks |
| Test | | An empty class for you to add your test code |
| TextBlocks | 15 | Example of Java text blocks from JEP 378 |
| TryWithResources | 7 | Demonstrates try-with-resources. Look for the invokevirtual call to close() on both the success and exception paths. |
| VarArgs | | Example of varargs parameters |
| VarKeyword | 10 | Example of the var keyword for type inference from JEP 286 |