{"id":95688,"date":"2020-10-09T11:00:00","date_gmt":"2020-10-09T08:00:00","guid":{"rendered":"https:\/\/examples.javacodegeeks.com\/?p=95688"},"modified":"2020-10-12T18:22:19","modified_gmt":"2020-10-12T15:22:19","slug":"java-15-new-features-tutorial","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/","title":{"rendered":"Java 15 New Features Tutorial"},"content":{"rendered":"<p>In this article, we provide a tutorial about the new features of Java 15. With a lot of improvements and modernization features, Java 15 arrived at the beginning of September. Let&#8217;s see them all together!<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-1-introduction\">1. Introduction<\/h2>\n<p>Java 15 came with fourteen new features, grouped in the following categories:<\/p>\n<div class=\"wp-block-image is-style-default\">\n<figure class=\"alignright size-large\"><img decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\" alt=\"Java 15\" class=\"wp-image-1204\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg 150w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo-70x70.jpg 70w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/><\/figure>\n<\/div>\n<ul class=\"wp-block-list\">\n<li>New Features\n<ul>\n<li>Edwards-Curve Digital Signature Algorithm (EdDSA)<\/li>\n<li>Hidden Classes<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul class=\"wp-block-list\">\n<li>Incubating and Preview Features\n<ul>\n<li>Sealed Classes &#8211; first preview<\/li>\n<li>Pattern Matching for instanceof &#8211; second preview<\/li>\n<li>Records &#8211; second preview<\/li>\n<li>Foreign-Memory Access API &#8211; second incubator<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul class=\"wp-block-list\">\n<li>Preview and Experimental Features\n<ul>\n<li>ZGC: A Scalable Low-Latency GC<\/li>\n<li>Text Blocks<\/li>\n<li>Shenandoah<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul class=\"wp-block-list\">\n<li>Modernizing the JDK\n<ul>\n<li>Deprecated\n<ul>\n<li>Biased locking<\/li>\n<li>RMI Activation<\/li>\n<\/ul>\n<\/li>\n<li>Removed\n<ul>\n<li>Nashorn JavaScript Engine<\/li>\n<li>Solaris and SPARC Ports<\/li>\n<\/ul>\n<\/li>\n<li>Reimplemented\n<ul>\n<li>Legacy Datagram Socket API<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\" id=\"h-2-pre-requisites\">2. Pre-requisites<\/h2>\n<p>For the next items with code examples, download one of this Java 15 version in your machine:<\/p>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/jdk.java.net\/15\/\">Oracle Open JDK<\/a> &#8211; offered under the open-source GNU General Public License v2, with the Classpath Exception (GPLv2+CPE).<\/li>\n<li><a rel=\"noreferrer noopener\" href=\"https:\/\/www.oracle.com\/java\/technologies\/javase-jdk15-downloads.html\" target=\"_blank\">Oracle JDK 15<\/a> &#8211; offered under a&nbsp;commercial license for those who want commercial support.<\/li>\n<\/ul>\n<p>In this article, we&#8217;ll use <strong>Oracle Open JDK<\/strong> and the examples will be executed on IntelliJ 2020.2 with Java 15 support. Download <a rel=\"noreferrer noopener\" href=\"https:\/\/www.jetbrains.com\/idea\/download\/#section=windows\" target=\"_blank\">here<\/a> as you wish. Make sure you got your proper OS version.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-3-java-15-new-features\">3. Java 15 New Features<\/h2>\n<h3 class=\"wp-block-heading\" id=\"h-3-1-edwards-curve-digital-signature-algorithm-eddsa\">3.1 Edwards-Curve Digital Signature Algorithm (EdDSA)<\/h3>\n<p>I&#8217;ll admit that feature it&#8217;s beyond my knowledge of encryption. Until today, I just used Java standard encryption. However, I&#8217;ll talk briefly about this feature.<\/p>\n<p>Basically, the EdDSA (<a href=\"https:\/\/openjdk.java.net\/jeps\/339\" target=\"_blank\" rel=\"noreferrer noopener\">JEP 339<\/a>) implements Edwards-Curve Digital Signature Algorithm (EdDSA) as described by&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/tools.ietf.org\/html\/rfc8032\" target=\"_blank\">RFC 8032<\/a>. According to JDK documentation, EdDSA is a modern elliptic curve signature scheme that has several advantages over the existing signature schemes in the JDK.<\/p>\n<p>The goal is to develop a platform-independent implementation of EdDSA, in addition, build a better performance than the existing ECDSA implementation (which uses native C code) at the same security strength.<\/p>\n<p>Find <a rel=\"noreferrer noopener\" href=\"https:\/\/openjdk.java.net\/jeps\/339\" target=\"_blank\">here<\/a> more details about this feature.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-3-2-hidden-classes\">3.2 Hidden Classes<\/h3>\n<p>Hidden classes (<a rel=\"noreferrer noopener\" href=\"https:\/\/openjdk.java.net\/jeps\/371\" target=\"_blank\">JEP 371<\/a>) is a feature more interesting to framework developers (Spring guys, I&#8217;m talking about you!). Frameworks are the target for this feature that generate classes at run time and use them indirectly, via reflection. <\/p>\n<p>Standard APIs that define a class <strong>ClassLoader::defineClass<\/strong> and <strong>Lookup::defineClass<\/strong> are indifferent to whether the bytecodes of the class were generated dynamically (at run time) or statically (at compile time). <\/p>\n<p>Using Lookup::defineHiddenClass we can create a hidden class. This causes the JVM to derive a hidden class from the supplied bytes, link the hidden class, and return a lookup object that provides reflective access to the hidden class.<\/p>\n<p>Since this article is focused on JDK, I won&#8217;t put any example about this feature, but I&#8217;m intending to do it in a near future.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-4-incubating-and-preview-features\">4. Incubating and Preview Features<\/h2>\n<p>Incubator modules are non-final APIs and non-final tools disposable for developers, allowing them to give feedback to improve the quality of these features.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-4-1-sealed-classes\">4.1 Sealed classes<\/h3>\n<p>A Sealed class or interface (<a href=\"https:\/\/openjdk.java.net\/jeps\/360\" target=\"_blank\" rel=\"noreferrer noopener\">JEP 360<\/a>) can be extended or implemented only by those classes and interfaces permitted to do so.<\/p>\n<p>The idea here is to allow the author of class or interface to control which code is responsible for implementing it, providing a more declarative way instead of use access modifiers (private, public, protected, default).<\/p>\n<p>A class is sealed by applying the <strong>sealed<\/strong> modifier to its declaration.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Animal.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package com.example.jcg.sealed;\n\npublic abstract sealed class Animal permits Bird, Cat, Dog{\n    public abstract void makeNoise();\n}\n<\/pre>\n<p>With the modifier <strong>permits<\/strong>, we define the classes that can implement the superclass. In addition, a class that extends a sealed class may be final to prevent the class hierarchy from being extended.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>When a class is not in super class, we got a compilation error when try to extend it:<\/p>\n<p><span style=\"text-decoration: underline\"><em>Human.java<\/em><\/span><\/p>\n<pre class=\"brush:java\"> \npackage com.example.jcg.sealed;\n\npublic class Human extends Animal{\n\n    @Override\n    public void makeNoise() {\n        System.out.println(\"Human cry.\");\n    }\n}\n\n<\/pre>\n<pre class=\"brush:bash\">Human.java:3:14\njava: class is not allowed to extend sealed class: com.example.jcg.sealed.Animal\n<\/pre>\n<h3 class=\"wp-block-heading\" id=\"h-4-2-pattern-matching-for-instanceof\">4.2 Pattern Matching for instanceof<\/h3>\n<p>Java 14 brings this feature on <a href=\"https:\/\/openjdk.java.net\/jeps\/305\" target=\"_blank\" rel=\"noreferrer noopener\">JEP 305<\/a>. On this second preview implemented in <a href=\"https:\/\/openjdk.java.net\/jeps\/375\" target=\"_blank\" rel=\"noreferrer noopener\">JEP 375<\/a>, the pattern matching allows developer a more concise and safe extraction of object&#8217;s components.<\/p>\n<p>We are familiar with instanceof idiom, using it with some code lines:<\/p>\n<p><span style=\"text-decoration: underline\"><em>Character.java with instanceof<\/em><\/span><\/p>\n<pre class=\"brush:java\">Character obj = new Character(\"Bilbo Baggins\");\n        if (obj instanceof Character) {\n            Character c = obj;\n            System.out.println(c.getName().contains(\"Bilbo\"));\n        } else {\n            System.out.println(\"Not character.\");\n        }\n<\/pre>\n<p>Using the pattern matching instanceof in Java 15, we got a cleaner way to do this check making the instanceof to cast into a variable the matched object.<\/p>\n<p><span style=\"text-decoration: underline\"><em>Character.java with instanceof in Java 15<\/em><\/span><\/p>\n<pre class=\"brush:java\">Character obj = new Character(\"Bilbo Baggins\");\n        if (obj instanceof Character c) {\n            System.out.println(c.getName().contains(\"Bilbo\"));\n        } else {\n            System.out.println(\"Not character.\");\n        }\n<\/pre>\n<h3 class=\"wp-block-heading\" id=\"h-4-3-records\">4.3 Records<\/h3>\n<p>Records are a new kind of class in Java. Proposed on <a rel=\"noreferrer noopener\" href=\"https:\/\/openjdk.java.net\/jeps\/359\" target=\"_blank\">JEP 359<\/a>, was delivered as a preview feature in JDK 14. This re-preview in JDK 15 (<a rel=\"noreferrer noopener\" href=\"https:\/\/openjdk.java.net\/jeps\/384\" target=\"_blank\">JEP 384<\/a>) is for refinements based on feedback and to support additional forms of local classes and interfaces in the Java language.  <\/p>\n<h4 class=\"wp-block-heading\" id=\"h-4-3-1-less-verbose-more-productivity\">4.3.1 Less verbose more productivity<\/h4>\n<p>A complaining that I always listened about Java is: &#8220;Java is too verbose.&#8221;. Ok, I agree with that. Some Java classes mean nothing in our journey into coding, they&#8217;re just data carriers that involve a lot of low-value, constructors, accessors, equals, hashCode and there it goes.<\/p>\n<p>To enhance the Java language, <strong>Records<\/strong> introduces a new kind of type declaration. The purpose of a record is to use a small group of variables considering them as a new kind of entity.<\/p>\n<p><span style=\"text-decoration: underline\"><em>BMICalculator.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package com.example.jcg.records;\n\nrecord BMICalculator(double height, double weight) {\n\n    public double calculate () {\n        return weight \/ (height * height);\n    }\n}\n<\/pre>\n<p>The keyword record will define our class as a Record type. As noticed, the <strong>BMICalculator<\/strong> class discards the use of local accessors (getters and setters) and we can focus on our implementation in the method <strong>calculate().<\/strong><\/p>\n<p>Furthermore, the local variables (in this case <strong>height<\/strong> and <strong>weight<\/strong>) will automatically have a public accessor with the same name and return type as that variable.<\/p>\n<p>So, Records makes code cleaner and faster for a better approach to understand how the class works, making the development easier.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-4-4-foreign-memory-access-api\"> 4.4 Foreign-Memory Access API<\/h3>\n<p>The first incubator of Foreign-Memory Access API was introduced on <a href=\"https:\/\/openjdk.java.net\/jeps\/370\" target=\"_blank\" rel=\"noreferrer noopener\">JEP 370<\/a> in JDK 14. The purpose of this second incubator in JDK 15 (<a href=\"https:\/\/openjdk.java.net\/jeps\/383\" target=\"_blank\" rel=\"noreferrer noopener\">JEP 383<\/a>). This incubating targets the refinement and enhancement of that feature.<\/p>\n<p>This API allow Java programs to safely and efficiently access foreign memory outside the Java heap. By providing a targeted solution to the problem of accessing foreign memory, developers will be freed of the limitations and dangers of existing APIs. <\/p>\n<p>The foreign-memory access API introduces three main abstractions: <strong>MemorySegment,<\/strong> <strong>MemoryAddress<\/strong> and <strong>MemoryLayout.<\/strong><\/p>\n<h2 class=\"wp-block-heading\" id=\"h-5-preview-and-experimental-features\">5. Preview and Experimental Features<\/h2>\n<p>The following preview features were promoted to product features after enhancements and feedback from the Java community. Here we&#8217;ll see what features are them.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-5-1-zgc-a-scalable-low-latency-gc\">5.1 ZGC: A Scalable Low-Latency GC<\/h3>\n<p>The Z Garbage Collector, also known as ZGC, is a scalable low-latency garbage collector. Integrated into JDK 11 (JEP 333) the goal is to reduce the pause times of GC, improving Java application performance. With <a rel=\"noreferrer noopener\" href=\"https:\/\/openjdk.java.net\/jeps\/377\" target=\"_blank\">JEP 377<\/a>, ZGC change from an experimental feature into a production feature.<\/p>\n<p>ZGC is enabled today with <strong>-XX:+UnlockExperimentalVMOptions -XX:+UseZGC <\/strong>command-line options, however with product promotion, these the -XX:+UnlockExperimentalVMOptions is no longer needed.<\/p>\n<p>These are some highlighted points after feedback and enhancements made during ZGC experimental period:<\/p>\n<ul class=\"wp-block-list\">\n<li>Concurrent class unloading<\/li>\n<li>Uncommitting unused memory (<a href=\"https:\/\/openjdk.java.net\/jeps\/351\" target=\"_blank\" rel=\"noreferrer noopener\">JEP 351<\/a>)<\/li>\n<li>Maximum heap size increased from 4TB to 16TB<\/li>\n<li>Minimum heap size decreased to 8MB<\/li>\n<li>-XX:SoftMaxHeapSize<\/li>\n<li>Support for the JFR leak profiler<\/li>\n<li>Support for class-data sharing<\/li>\n<li>Limited and discontiguous address spaces<\/li>\n<li>Support for placing the heap on NVRAM<\/li>\n<li>Improved NUMA awareness<\/li>\n<li>Multi-threaded heap pre-touching<\/li>\n<\/ul>\n<h3 class=\"wp-block-heading\" id=\"h-5-2-text-blocks\">5.2 Text Blocks<\/h3>\n<p>A text block is a multi-line string literal that avoids the need for most escape sequences, automatically formats the string in a predictable way, and gives the developer control over format when desired. This feature was introduced in <a href=\"https:\/\/openjdk.java.net\/jeps\/355\" target=\"_blank\" rel=\"noreferrer noopener\">JEP 355<\/a> and now is available as a permanent feature in Java language (J<a href=\"https:\/\/openjdk.java.net\/jeps\/378\" target=\"_blank\" rel=\"noreferrer noopener\">EP 378<\/a>).<\/p>\n<p>When we needed to write a multi-line string like an SQL script, we need to do as below:<\/p>\n<p><span style=\"text-decoration: underline\"><em>Traditional String multi-line<\/em><\/span><\/p>\n<pre class=\"brush:java\">    \nString sql = \"SELECT \\\"EMP_ID\\\", \\\"LAST_NAME\\\" FROM \\\"EMPLOYEE_TB\\\"\\n\" +\n            \"WHERE \\\"CITY\\\" = 'INDIANAPOLIS'\\n\" +\n            \"ORDER BY \\\"EMP_ID\\\", \\\"LAST_NAME\\\";\\n\";\n<\/pre>\n<p>Now, with text blocks we can do this in a cleaner and easier way:<\/p>\n<p><span style=\"text-decoration: underline\"><em>Text block String multi-line<\/em><\/span><\/p>\n<pre class=\"brush:java\">String sql = \"\"\"\n             SELECT \"EMP_ID\", \"LAST_NAME\" FROM \"EMPLOYEE_TB\"\n             WHERE \"CITY\" = 'INDIANAPOLIS'\n             ORDER BY \"EMP_ID\", \"LAST_NAME\";\n             \"\"\";\n<\/pre>\n<p>No more need to use \\n to break lines or \\ and <em>+<\/em> to concatenate when build a string in multiple lines. This is a prettier and practical way to do that.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-5-3-shenandoah\">5.3 Shenandoah<\/h3>\n<p>Shenandoah is an algorithm that reduces GC pause times by doing evacuation work concurrently with the running Java threads.&nbsp;Integrated in JDK 12 (JEP 189) , now this feature is promoted to the product in JDK 15 (<a rel=\"noreferrer noopener\" href=\"https:\/\/openjdk.java.net\/jeps\/379\" target=\"_blank\">JEP 389<\/a>). <\/p>\n<p>The intent of Shenandoah feature is not replace the default GC, which remains G1, but offers in Open JDK a low-pause time collector. Another propose in this JEP is not to change the Shenandoah development process, which will continue to support both the latest JDK and popular LTS\/STS JDKs. <\/p>\n<p>To use this feature, in JDK 12 until JDK 14, we need the JVM: XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC. Now in JDK 15, the option -XX:+UseShenandoahGC is no longer needed.<\/p>\n<p>Details about Shenandoah algorithm can be found <a href=\"https:\/\/www.researchgate.net\/publication\/306112816_Shenandoah_An_open-source_concurrent_compacting_garbage_collector_for_OpenJDK\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-6-modernizing-the-jdk\">6. Modernizing the JDK <\/h2>\n<p>To preserve the reliability and maintainability in JDK as long as the language evolves, some features are outdated or has their use reduced and replace by new and enhanced features. Moreover, a feature is never removed before being deprecated for at least one release first. JDK 15 deprecates two features and removes two other, that were previously deprecated. <\/p>\n<h3 class=\"wp-block-heading\" id=\"h-6-1-deprecated-features\">6.1 Deprecated Features<\/h3>\n<h4 class=\"wp-block-heading\" id=\"h-6-1-1-biased-locking\">6.1.1 Biased locking<\/h4>\n<p>Biased locking is an optimization technique used in the HotSpot Virtual Machine to reduce the overhead of uncontended locking.&nbsp;The <a href=\"https:\/\/openjdk.java.net\/jeps\/374\" target=\"_blank\" rel=\"noreferrer noopener\">JEP 374<\/a> disables biased locking by default, and deprecate all related command-line options.<\/p>\n<h4 class=\"wp-block-heading\" id=\"h-6-1-2-rmi-activation\">6.1.2 RMI Activation<\/h4>\n<p>RMI Activation is an obsolete part of RMI that has been optional since JDK 8. This RMI mechanism allows RMI-based services to export stubs whose validity exceeds the lifetime of a remote object or a JVM that contains it. In JDK 15 (<a href=\"https:\/\/openjdk.java.net\/jeps\/385\" target=\"_blank\" rel=\"noreferrer noopener\">JEP 385<\/a>) this mechanism is deprecated for future removal.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-6-2-removed-features\">6.2 Removed Features<\/h3>\n<h4 class=\"wp-block-heading\" id=\"h-6-2-1-nashorn-javascript-engine\">6.2.1 Nashorn JavaScript Engine<\/h4>\n<p>The Nashorn JavaScript engine was first incorporated into JDK 8 via&nbsp;<a href=\"https:\/\/openjdk.java.net\/jeps\/174\">JEP 174<\/a>&nbsp;as a replacement for the Rhino scripting engine. When it was released, it was a complete implementation of the ECMAScript-262 5.1 standard. <\/p>\n<p>With ECMAScript rapid pace evolution, Nashorn was difficult to maintain. This feature was deprecated in JDK 11 (<a href=\"https:\/\/openjdk.java.net\/jeps\/335\" target=\"_blank\" rel=\"noreferrer noopener\">JEP 355<\/a>) and now is been removed in <a href=\"https:\/\/openjdk.java.net\/jeps\/372\" target=\"_blank\" rel=\"noreferrer noopener\">JEP 372<\/a>.<\/p>\n<p>The below packages will be permanently removed:<\/p>\n<ul class=\"wp-block-list\">\n<li><strong>jdk.scripting.nashorn <\/strong>&#8211; contains the jdk.nashorn.api.scripting and jdk.nashorn.api.tree packages.<\/li>\n<li><strong>jdk.scripting.nashorn.shell<\/strong> &#8211; contains the jjs tool.<\/li>\n<\/ul>\n<h4 class=\"wp-block-heading\" id=\"h-6-2-2-solaris-and-sparc-ports\">6.2.2 Solaris and SPARC Ports<\/h4>\n<p><a href=\"https:\/\/openjdk.java.net\/jeps\/381\" target=\"_blank\" rel=\"noreferrer noopener\">JEP 381<\/a> removes the source code and build support for the Solaris\/SPARC, Solaris\/x64, and Linux\/SPARC ports. These ports were&nbsp;deprecated for removal in JDK 14&nbsp;(<a href=\"https:\/\/openjdk.java.net\/jeps\/362\">JEP 362<\/a>) with the express intent to remove them in a future release.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-6-3-reimplemented-feature\">6.3 Reimplemented Feature<\/h3>\n<h4 class=\"wp-block-heading\" id=\"h-6-3-1-legacy-datagram-socket-api\">6.3.1 Legacy Datagram Socket API<\/h4>\n<p>DatagramSocket and MulticastSocket APIs were rebuilt with simpler and more modern implementations that are easy to maintain and debug. Therefore, the old design is a mix of legacy Java and C code that is painful to handle with. <\/p>\n<p>The <a rel=\"noreferrer noopener\" href=\"https:\/\/openjdk.java.net\/jeps\/373\" target=\"_blank\">JEP 373<\/a> is a sequence of&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/openjdk.java.net\/jeps\/353\" target=\"_blank\">JEP 353<\/a>, which already reimplemented the legacy Socket API. More details on how to use this feature can be found on <a rel=\"noreferrer noopener\" href=\"https:\/\/openjdk.java.net\/projects\/loom\/\" target=\"_blank\">Project Loom<\/a>.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-7-summary\">7. Summary<\/h2>\n<p>In this article, we could see all features presented in Java 15 release. Some features are very useful for developers such as Text Blocks, Records, Pattern Matching, and others are in the background of JVM like ZGC, Shenandoah and Foreign Access Memory. All this content is based on Oracle official Java blog, that you can find <a rel=\"noreferrer noopener\" href=\"https:\/\/blogs.oracle.com\/java-platform-group\/the-arrival-of-java-15\" target=\"_blank\">here<\/a>.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-8-download-the-source-code\">8. Download the source code<\/h2>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/10\/java-15-tutorial.zip\"><strong>Java 15 New Features Tutorial<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this article, we provide a tutorial about the new features of Java 15. With a lot of improvements and modernization features, Java 15 arrived at the beginning of September. Let&#8217;s see them all together! 1. Introduction Java 15 came with fourteen new features, grouped in the following categories: New Features Edwards-Curve Digital Signature Algorithm &hellip;<\/p>\n","protected":false},"author":239,"featured_media":1204,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-95688","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-core-java"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Java 15 New Features Tutorial - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In this article, we provide a tutorial about the new features of Java 15. With a lot of improvements and modernization features, Java 15 arrived at the\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java 15 New Features Tutorial - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In this article, we provide a tutorial about the new features of Java 15. With a lot of improvements and modernization features, Java 15 arrived at the\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2020-10-09T08:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-10-12T15:22:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sergio Lauriano Junior\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@sergiolauriano\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sergio Lauriano Junior\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/\"},\"author\":{\"name\":\"Sergio Lauriano Junior\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/79f2e4070e5cb0ccb5fd87ab3ac1f9fe\"},\"headline\":\"Java 15 New Features Tutorial\",\"datePublished\":\"2020-10-09T08:00:00+00:00\",\"dateModified\":\"2020-10-12T15:22:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/\"},\"wordCount\":1832,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"articleSection\":[\"Core Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/\",\"name\":\"Java 15 New Features Tutorial - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"datePublished\":\"2020-10-09T08:00:00+00:00\",\"dateModified\":\"2020-10-12T15:22:19+00:00\",\"description\":\"In this article, we provide a tutorial about the new features of Java 15. With a lot of improvements and modernization features, Java 15 arrived at the\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"Bipartite Graph\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Core Java\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Java 15 New Features Tutorial\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/79f2e4070e5cb0ccb5fd87ab3ac1f9fe\",\"name\":\"Sergio Lauriano Junior\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/09\/sergio_photo-96x96.jpeg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/09\/sergio_photo-96x96.jpeg\",\"caption\":\"Sergio Lauriano Junior\"},\"description\":\"Sergio is graduated in Software Development in the University City of S\u00e3o Paulo (UNICID). During his career, he get involved in a large number of projects such as telecommunications, billing, data processing, health and financial services. Currently, he works in financial area using mainly Java and IBM technologies.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/sergio-lauriano\/\",\"https:\/\/x.com\/@sergiolauriano\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/sergio-lauriano\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java 15 New Features Tutorial - Java Code Geeks","description":"In this article, we provide a tutorial about the new features of Java 15. With a lot of improvements and modernization features, Java 15 arrived at the","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/","og_locale":"en_US","og_type":"article","og_title":"Java 15 New Features Tutorial - Java Code Geeks","og_description":"In this article, we provide a tutorial about the new features of Java 15. With a lot of improvements and modernization features, Java 15 arrived at the","og_url":"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2020-10-09T08:00:00+00:00","article_modified_time":"2020-10-12T15:22:19+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","type":"image\/jpeg"}],"author":"Sergio Lauriano Junior","twitter_card":"summary_large_image","twitter_creator":"@sergiolauriano","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Sergio Lauriano Junior","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/"},"author":{"name":"Sergio Lauriano Junior","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/79f2e4070e5cb0ccb5fd87ab3ac1f9fe"},"headline":"Java 15 New Features Tutorial","datePublished":"2020-10-09T08:00:00+00:00","dateModified":"2020-10-12T15:22:19+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/"},"wordCount":1832,"commentCount":1,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","articleSection":["Core Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/","url":"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/","name":"Java 15 New Features Tutorial - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","datePublished":"2020-10-09T08:00:00+00:00","dateModified":"2020-10-12T15:22:19+00:00","description":"In this article, we provide a tutorial about the new features of Java 15. With a lot of improvements and modernization features, Java 15 arrived at the","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2012\/12\/java-logo.jpg","width":150,"height":150,"caption":"Bipartite Graph"},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/java-15-new-features-tutorial\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"},{"@type":"ListItem","position":3,"name":"Core Java","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/"},{"@type":"ListItem","position":4,"name":"Java 15 New Features Tutorial"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/79f2e4070e5cb0ccb5fd87ab3ac1f9fe","name":"Sergio Lauriano Junior","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/09\/sergio_photo-96x96.jpeg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2020\/09\/sergio_photo-96x96.jpeg","caption":"Sergio Lauriano Junior"},"description":"Sergio is graduated in Software Development in the University City of S\u00e3o Paulo (UNICID). During his career, he get involved in a large number of projects such as telecommunications, billing, data processing, health and financial services. Currently, he works in financial area using mainly Java and IBM technologies.","sameAs":["https:\/\/www.linkedin.com\/in\/sergio-lauriano\/","https:\/\/x.com\/@sergiolauriano"],"url":"https:\/\/examples.javacodegeeks.com\/author\/sergio-lauriano\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/95688","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/239"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=95688"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/95688\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/1204"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=95688"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=95688"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=95688"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}