Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Java 11 and 12 ??? New Features

You're reading from   Java 11 and 12 ??? New Features Learn about Project Amber and the latest developments in the Java language and platform

Arrow left icon
Product type Paperback
Published in Mar 2019
Publisher Packt
ISBN-13 9781789133271
Length 242 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Mala Gupta Mala Gupta
Author Profile Icon Mala Gupta
Mala Gupta
Arrow right icon
View More author details
Toc

Table of Contents (23) Chapters Close

Preface 1. Section 1: JDK 10
2. Type Inference FREE CHAPTER 3. AppCDS 4. Garbage Collector Optimizations 5. Miscellaneous Improvements in JDK 10 6. Section 2: JDK 11
7. Local Variable Syntax for Lambda Parameters 8. Epsilon GC 9. The HTTP Client API 10. ZGC 11. Flight Recorder and Mission Control 12. Miscellaneous Improvements in JDK 11 13. Section 3: JDK 12
14. Switch Expressions 15. Miscellaneous Improvements in JDK 12 16. Section 4: Project Amber
17. Enhanced Enums in Project Amber 18. Data Classes and Their Usage 19. Raw String Literals 20. Lambda Leftovers 21. Pattern Matching 22. Other Books You May Enjoy

Getting started with the HelloEpsilon GC class

Let's write a HelloEpsilon class and execute it using Epsilon GC. Here's the sample code:

class HelloEpsilonGC { 
    public static void main(String[] args) { 
        System.out.println("Hello to Epsilon GC!"); 
    } 
} 

To execute the preceding code using Epsilon GC, you must use the -XX:+UnlockExperimentalVMOptions option with the -XX:+UseEpsilonGC option, followed by the class to execute:

    >java -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC 
HelloEpsilonGC

The following screenshot highlights the preceding command at the top; the remaining part includes the GC output:

As highlighted in the preceding screenshot, the following describes the GC output:

  • JVM uses the Epsilon GC
  • It outputs the Hello to Epsilon GC! string to the standard output
  • It includes just one allocation of 792 KB
The literal...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image