Add java21-features module: runnable demos and captured output for the ankurm.com java21-features article
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
import java.lang.management.*;
|
||||
|
||||
/** JEP 439 (final): Generational ZGC is opt-in on 21 with -XX:+ZGenerational. Prints the GC beans each mode registers. */
|
||||
public class GcNamesDemo {
|
||||
public static void main(String[] args) {
|
||||
for (GarbageCollectorMXBean b : ManagementFactory.getGarbageCollectorMXBeans()) System.out.println("gc bean : " + b.getName());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user