Runtime.version()
The standard-library method a running program calls to learn which Java version it is running on.
In more detail
Runtime.version() returns a Runtime.Version object whose feature() method gives the feature release number, such as 21. It lets a program report or check its own platform at runtime. The course uses it to show that the class file version is the feature number plus 44.
Example
Runtime.version().feature() // 21Related terms
- release train — A release schedule that ships on fixed dates, carrying whatever features are ready, instead of waiting for particular features.
- class file version — The number stored in every class file that records which Java release it targets, so an older JVM can refuse a file from the future.
Taught in
- Release Trains And Long Term Support — Modern Java: Virtual Threads & High-Throughput Services