Java / GraalVM Interview questions
What is ahead-of-time (AOT) compilation?
Ahead-of-time compilation means translating code into machine instructions before the program runs, as a build step, rather than compiling hot methods on the fly while the program executes (just-in-time compilation).
In GraalVM, Native Image performs AOT compilation: it statically analyzes every class, method, and field reachable from the application's entry point and compiles all of it into a native executable in one pass at build time.
The upside is instant startup and predictable performance from the first request, since there's no interpreter-then-JIT warm-up phase. The downside is that anything not visible to that static analysis - like a class loaded via a string computed at runtime - needs to be explicitly declared, because there's no runtime classloader to fall back on.
More Related questions...