Byte-Me logo, a pair of wind-up chattering teeth!

Byte-Me: A Java Bytecode Explorer

Show Examples 
--enable-preview level

Java Source Code
Source: Target:
ExampleSinceDescription
AddAdd 2 ints together. Simple demonstration of stack machine.
AnnotationsDemonstrates annotations
ArraysDemonstrates array allocation in bytecode
AssertDemonstrates bytecode created by the assert keyword
CallPrivateMethodCompare 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
ClassicSwitchesDemonstrates the classic tableswitch and lookupswitch bytecode
ConstantOptimisationShows that javac will perform simple mathematics on constants to reduce the bytecode
DeadCodeIllustrates dead code elimination for static final guards
EnumSizeExample of a Java enum
ErasureDemonstrates type erasure
ExceptionsDemonstrates the MethodInfo exceptions table
GenericsShows how the class file captures generics information in the Signature attribute.
ImplicitConstructorDemonstrates the creation of a no-arg constructor method where instance fields are initialised
IncrementNotice 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.
InnerClassesExamples of inner classes
LoopyExplore the bytecode between different kinds of Java loop
MethodParametersDemonstrates passing method parameters
NoClass21Demonstrates implicitly declared classes and instance main methods JEP 463
PersonRecord16Example of a Java record JEP 395
PrimitiveSwitchExpressions23Demonstrates switch expressions on primitives JEP 455
SealedAnimal18Example of sealed classes from JEP 409
ShapeExample of a Java interface with single implementation
StatementsBeforeSuper22Demonstrates statements before superclass constructor call JEP 447
StaticInitialiserDemonstrstrates static initialisation code
StringTemplate21Demonstrates StringTemplate feature from JEP 430
SwitchExpressions14Demonstrates switch expressions introduced by JEP 361
SynchronizedDemonstrates sychronized methods and blocks
TestAn empty class for you to add your test code
TextBlocks15Example of Java text blocks from JEP 378
TryWithResources7Demonstrates try-with-resources. Look for the invokevirtual call to close() on both the success and exception paths.
VarArgsExample of varargs parameters
VarKeyword10Example of the var keyword for type inference from JEP 286

Byte-Me / Copyright 2023-2024 Chris Newland / Inspired by JCrete / Java Runtime: 21.0.4-internal-adhoc.ubuntu.jdk21 / JVM Options: -Xms2g -Xmx4g -Xlog:gc --enable-preview