pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/wesleyegberto/java-new-features/tree/master/java-18

primer-70be7debc79a8eff.css" /> java-new-features/java-18 at master · wesleyegberto/java-new-features · GitHub
Skip to content

Latest commit

 

History

History

README.md

Java 18

To run each example use: java --enable-preview --source 18 <FileName.java>

JEPs

  • 400 - UTF-8 by Default
  • 408 - Simple Web Server
  • 413 - Code Snippets in Java API Documentation
  • 416 - Reimplement Code Reflection with Method Handles
  • 417 - Vector API (Third Incubator)
  • 418 - Internet-Address Resolution SPI
  • 419 - Foreign Function & Memory API (Second Incubator)
  • 420 - Pattern matching for switch (Second Preview)
  • 421 - Deprecate Finalization for Removal

Features

  • Chartset UTF-8 by Default
    • to see which is default: java -XshowSettings:properties -version 2>&1 | grep file.encoding
    • we can change the chartset with property: -Dfile.encoding=UTF-8
    • affected classes:
      • Stream Reader and Writer
      • File Reader and Writer
      • Formatter and Scanner
      • URLEncoder and URLDecoder
    • the System.out and System.err will use the same charset from the terminal
      • we can see with: Console.charset()
  • Pattern Matching for switch (second preview)
    • Minor improvements from JDK 17:
      • refined to use dominance checking that will force constant case label to appear before a guarded pattern of the same type;
      • exhaustiveness checking is now more precise with sealed hierarchies.
  • Code snippet in Java Doc
    • was introduced the @snippet tag to help write code fragments in Java docs
    • the goals is to provide a way to get this fragments (so it can be validated by other tool), enable syntax highlighting and provide better IDE support
    • code snippet suports:
      • attributes (key-pair values like usage="sort")
      • ID to be referred in others snippets (through id attribute)
      • language definition (through lang attribute) - default is java
      • external files (through file attribute) - using external file to define the snippets allow us to use everything that Java supports (like comments with /** */)
    • we can pass --snippet-path to javadoc tool to define the folders for external snippets
    • example:

JVM

  • Reimplemented code reflection to use Method Handles

Links

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy