#
JAVA tutorials - free tutorials, free articles
On this section we have a lot of tutorials for learning Java. This is not a complete guide, but our tutorials will help you understand better Java.
#
New features in Java
Here we can see some features introduced in the last Java versions. More information regarding Java history you can have on Wikipedia.
Notations:
JEP
= Java Enhancement Proposal- An
Incubator
modules are a means of putting non-final APIs and non-final tools in the hands of developers, while the APIs/tools progress towards either finalization or removal in a future release. - A
Preview
feature is a new feature of the Java language, Java Virtual Machine, or Java SE API that is fully specified, fully implemented, and yet impermanent. It is available in a JDK feature release to provoke developer feedback based on real world use; this may lead to it becoming permanent in a future Java SE Platform.
#
Java 8 (LTS) - released on March 2014
- Optional classes
- LocalDate, LocalTime, LocalDateTime in java.time package
- Default methods in interfaces
- Static methods in interfaces
- Functional interfaces & lambda expression
- Method & constructor reference
- forEach method in Iterable interface
- stream() & parallelStream() methods in Collection interfaces
- Base64 encoding & decoding
#
Java 9
- Java modules
- Private method in interfaces
- New HTTP client which supports HTTP/2 protocols & WebSocket
- java.lang.ProcessHandle - to control the OS processes
- Flow Class (for reactive programming) which includes 4 interfaces : Publisher, Subscriber, Subscription and Processor
#
Java 10
- "var" Local-Variable Type
- Immutable Collections
- Optional.orElseThrow()
- Time-Based Release Versioning
- Garbage Collector improvement
#
Java 11 (LTS) - released on September 2018
- New HTTP (and WebSocket) Client (Standard)
- New String Methods
- New methods for File class
- Directly run the Java file
- Local var syntax in Lambda parameters
- Collection to an Array
- "not" method added to the Predicate interface
- Epsilon Garbage Collector
- Java EE and CORBA modules was removed
- JavaFX goes its own way
- Flight Recorder becomes open-source
#
Java 12
- New "switch" expressions for Pattern matching (preview feature)
- New String Methods
- File::mismatch method added
- Compact Number Formatting
- Teeing Collectors in Stream API
#
Java 13
- "yield" keyword added to "switch" expressions (preview feature)
- Text blocks for multi-line Strings (preview feature)
- Reimplement the java.net.Socket and java.net.ServerSocket APIs
#
Java 14
- Switch Expressions (Standard)
- Pattern Matching for instanceof (Preview)
- More helpful NullPointerExceptions
- Records (Preview)
- Text Blocks (Second Preview)
#
Java 15
- Text Blocks (Standard)
- Sealed Classes (Preview)
- Pattern Matching Type Checks (Preview)
- Hidden Classes
#
Java 16
- New Stream Methods
- Pattern Matching for instanceof (Standard)
- Records (Standard)
- Sealed Classes (Second Preview)
- OpenJDK source code is migrated from Mercurial to GitHub
#
Java 17 (LTS) - released on September 2021
- Sealed Classes (Standard)
- Pattern Matching for switch (Preview)
- Enhanced Pseudo-Random Number Generators
- Removal Experimental AOT and JIT Compiler
#
Java 18
- UTF-8 by Default
- Simple Web Server (Prototype)
- Internet-Address Resolution SPI
- Pattern Matching for switch (Preview)
- Improvements to Javac Compiler
- Code Snippets in Java API Documentation
- Vector APIs (Incubator)
#
Java 19
- Virtual Threads (Preview)
- Vector API (Incubator)
- Pattern Matching for switch (Preview)
#
Java 20
- Virtual Threads (Preview)
- Pattern Matching for switch (Preview)
- Vector API (Incubator)
#
Java 21 (LTS) - released on 19 September 2023
- Virtual Threads
- Sequenced collections :
SequencedCollection
,SequencedMap
andSequencedSet
interface - Structured concurrency (Preview) -
StructuredTaskScope
class - Scoped values (Preview):
ScopeValue
class - share immutable data between methods in a thread (vsThreadLocal
). - String templates (Preview)
- Unnamed Classes and Instance Main Methods (Preview)
#
Java 22 - released on 19th March 2024
- unnamed variables : the variable must exist for the syntax to be valid, but not used in the code -> in this case we can use underscore "_".
- we can create/ define intermediate operations in Streams using Gatherers.
- we can add code before this() or super() constructors.
#
What kind of programming language is Java ?
Java is a :
general purpose language : it is used for Mobile Application Development, Enterprise Software, Scientific Computing Applications, Web servers and application servers, Artificial Intelligence, Big Data, Internet of Things, Blockchain Mobile Development, Web Development.
platform independent language : the Java code is compiled by Java compiler into bytecode (.class files) which is converted by the JVM (Java Virtual Machine) into machine language (which is the same as machine code.). The machine language is the only one understood by the CPU.
object-oriented language : the data (or the attributes) are managed with the methods and together could create objects. The objects could contain other objects.
statically-typed : it is expected that its variables to be declared before they can be assigned values.