Kayıtlar

Ocak, 2020 tarihine ait yayınlar gösteriliyor

Java 12 New Features

Java SE 12 was released in March 2019. The full list of new features in JDK 12 can be found here: https://openjdk.org/projects/jdk/12/   In this tutorial, we will look at some of these new features and examine some of them. 1. JEP 189:  Shenandoah: A Low-Pause-Time Garbage Collector (Experimental) Shenandoah is a new garbage collection (GC) algorithm which reduces GC pause times,  independent of heap size. This GC algorithm is experimental so in order to use it with Java 12, you have to enable it : -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC 2. JEP 325:  Switch Expressions (Preview) This JEP extends the switch statement to be used as either a statement or an expression. Meaning that we can now return a value from a switch expression. Before Java 12, we can return a value by assigning it to a variable: String getColor(int num) { String result = ""; switch (number) { case 1, 2, 3: result = "red, green or blue"; break;

Java 11 New Features

Java SE 11 was released in September 2018. The full list of new features in JDK 11 can be found here: http://openjdk.java.net/projects/jdk/11/   In this tutorial, we will look at some of these new features and examine some of them. 1. JEP 181: Nest-Based Access Control Java 11 introduces the concept of nestmates. The main class and the types within that form a nest. Members of a nest are called nestmates of each other. JVM allows access to private members between nestmates. However, before Java 11, accessing to private members between nestmates over reflection api is denied. The JEP solves this problem. 2. JEP 318: Epsilon: A No-Op Garbage Collector Epsilon is a No-Op Garbage Collector which does collect nothing and when the heap is full then it will shut down the jvm. It could be used for testing use-cases.  Epsilon GC is experimental and could be used with the following jvm parameters: -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC 3. J