Java Tutorials

Comparator vs Comparable

TL;DR Comparable β†’ put the natural order inside the class (one order). Comparator β†’ define external strategies outside the class (many orders). Core differences Package & method Comparable<T> (java.lang) β†’...

Comparator vs Comparable

TL;DR Comparable β†’ put the natural order inside the class (one order). Comparator β†’ define external strategies outside the class (many orders). Core differences Package & method Comparable<T> (java.lang) β†’...

Java 17 Features

βœ… Java 17 Features (Released: September 2021) Java 17 is a Long-Term Support (LTS) release, making it a very important milestone after Java 11. 1. πŸ”Ή Sealed Classes (Final –...

Java 17 Features

βœ… Java 17 Features (Released: September 2021) Java 17 is a Long-Term Support (LTS) release, making it a very important milestone after Java 11. 1. πŸ”Ή Sealed Classes (Final –...

Java 15 and 16 Features

βœ… Java 15 Features (Released: Sept 2020) 1. πŸ”Ή Text Blocks (Standard – JEP 378) Final version of multi-line string literals introduced as preview in Java 13/14. Example: String html...

Java 15 and 16 Features

βœ… Java 15 Features (Released: Sept 2020) 1. πŸ”Ή Text Blocks (Standard – JEP 378) Final version of multi-line string literals introduced as preview in Java 13/14. Example: String html...

Java 14 Features

1. πŸ”ΉΒ Switch Expressions (Standard Feature – JEP 361) After being in preview in Java 12 and 13, switch expressions became official in Java 14. Example: String day = "MONDAY"; int...

Java 14 Features

1. πŸ”ΉΒ Switch Expressions (Standard Feature – JEP 361) After being in preview in Java 12 and 13, switch expressions became official in Java 14. Example: String day = "MONDAY"; int...

Java 12 features

Here’s a detailed yet simple list of the key features introduced in Java 12, along with explanations and code examples: βœ… Top Features of Java 12 Released in March 2019,...

Java 12 features

Here’s a detailed yet simple list of the key features introduced in Java 12, along with explanations and code examples: βœ… Top Features of Java 12 Released in March 2019,...

Java 11 Features

1. πŸ”ΉΒ New HttpClient API (Standard) Upgraded from incubator in Java 9 β†’ Now stable and production-ready. Example: import java.net.http.*; import java.net.URI; public class HttpExample { public static void main(String[] args)...

Java 11 Features

1. πŸ”ΉΒ New HttpClient API (Standard) Upgraded from incubator in Java 9 β†’ Now stable and production-ready. Example: import java.net.http.*; import java.net.URI; public class HttpExample { public static void main(String[] args)...