Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

This is a simple poc using the new version o Java language

License

NotificationsYou must be signed in to change notification settings

luramarchanjo/poc-java-14

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Java 14 was release at 03/2020 and the main features are:

"Currency format instances with accounting style, in which the amount is formatted in parentheses insome locales, can be obtained by calling NumberFormat.getCurrencyInstance(Locale) with the"u-cf-account" Unicode locale extension. For example in Locale.US, it will format to "($3.27)"instead of "-$3.27". Refer to CLDR's accounting currency format style for additional information."

In JDK 14, the Records (JEP 359) preview feature adds a new class java.lang.Record. The java.langpackage is implicitly imported on demand, that is, import java.lang.. If code in an existingsource file imports some other package on demand, for example, import com.myapp.;, and that otherpackage declares a type called Record, then code in the existing source file which refers to thattype will not compile without change. To make the code compile, import the other package's Recordtype using a single-type import, for example, import com.myapp.Record;.

Compiling and running

To compile you need to enable the preview feature, to do that, execute the command bellow:

javac --enable-preview --release 14 src/main/java/com/example/RecordPerson.java src/main/java/com/example/RecordMain.java

To test your application use need to run the command bellow:

java --enable-preview -cp src/main/* com.example.RecordMain

Enhance the Java programming language with pattern matching for the instanceof operator. Patternmatching allows common logic in a program, namely the conditional extraction of components fromobjects, to be expressed more concisely and safely. This is a preview language feature in JDK 14.

Compiling and running

To compile you need to enable the preview feature, to do that, execute the command bellow:

javac --enable-preview --release 14 src/main/java/com/example/PatternMatching.java

To test your application use need to run the command bellow:

java --enable-preview -cp src/main/* com.example.PatternMatching

Create a tool for packaging self-contained Java applications.

Packing and running

To package your application, run the command bellow:

jpackage --name poc-java-14 --input target/ --main-jar poc-java-14-1.0-SNAPSHOT.jar --main-class com.example.PatternMatching

To run your application, execute the generated filepoc-java-14* at your root folder:

  • Linux: deb and rpm
  • macOS: pkg and dmg
  • Windows: msi and exe

Improve the usability of NullPointerExceptions generated by the JVM by describing precisely whichvariable was null.

Extend switch so it can be used as either a statement or an expression, and so that both forms canuse either traditional case ... : labels (with fall through) or new case ... ->labels (with no fall through), with a further new statement for yielding a value from a switchexpression. These changes will simplify everyday coding, and prepare the way for the use of patternmatching in switch. This was a preview language feature in JDK 12 and JDK 13.

Add text blocks to the Java language. A text block is a multi-line string literal that avoids theneed for most escape sequences, automatically formats the string in a predictable way, and gives thedeveloper control over the format when desired. This is a preview language feature in JDK 14.

About

This is a simple poc using the new version o Java language

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp