Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Java — The New Bits from Java 10 to Java 21

Tags: java

Sign upSign InSign upSign InMember-only storyBrian EnochsonFollowLevel Up Coding--ShareIf you are like me, you spent years using Java 8. Then watched all the cool new features being released, read about them, but were still using Java 8 in your day-to-day work. I moved to Java 11 at some point am now using Java 17 every day and likely to move to Java 21 soon. Considering this, I believed it was time to make sure I understand all of the new features out there so I can make sure I use them in my everyday work.We will go through many of the features from Java 10 to Java 21 with code examples. This is not an exhaustive list, but rather a highlight of the major additions I found interesting. They are presented in no specific order other than a general sequence by the order of their introduction to the language. Some of these have been around for years, but maybe are not well known to all of us, while others are very recent additions.Many of these, for instance HttpClient and Virtual Threads are only introduced. These certainly deserve more detail and there are many examples of more in depth coverage that can be found. Again, this is a list of the new features with short explanations and sample code. Nothing more.The accompanying code can be found in my Github repository here.As of JDK 10 and later, you can declare local variables with non-null initializers with the var identifier. Java automatically infers the type of a variable using the initial value assigned to a variable declared with var.This removes redundancy like the following example, where obviously the reader variable is of a type Reader and class BufferedReader because of how it is initialized.instead you can writeSome basic rules----Level Up CodingDeveloper… you know. Interested in everything technology related.Brian EnochsoninLevel Up Coding--Victor TimiinLevel Up Coding--27Arslan AhmadinLevel Up Coding--17Brian EnochsoninStackademic--Svosh--Gilberto Machado--Firoud reda--1AmirhoseininJavarevisited--Berkay HaberalinStackademic--6Abishan Parameswaran--HelpStatusWritersBlogCareersPrivacyTermsAboutText to speechTeams



This post first appeared on VedVyas Articles, please read the originial post: here

Share the post

Java — The New Bits from Java 10 to Java 21

×

Subscribe to Vedvyas Articles

Get updates delivered right to your inbox!

Thank you for your subscription

×