Java 8 is the major release of Java programming language because, in the entire history of Java, it never release that many major features.
It consists of major features of Java and was released by Oracle on 18 March 2014.
In this release, it provided support for functional programming, a new JavaScript engine, streaming API, functional interfaces, default methods, date-time API changes, etc.
Prerequisites:- Knowledge of basic Java programming language is required for learning the Java 8. If you are new to Java please read our Java Tutorial.
Major features of Java 8 : -
- Functional Interfaces − In java 8 onwards, an interface can have only one abstract method and 'n' number of static and default methods. These are called functional interface.
- Lambda Expressions − Adds functional programming capability to Java where developer can write very short code to achieve the requirement.
- Default method − Interface can also have default method implementation.
- Method Reference − Referencing functions by their names instead of invoking them directly. Using functions as parameter.
- Streams − New stream API to facilitate pipeline processing.
- Optional Class − Emphasis on best practices to handle null values/ Null Pointer Exception properly.
- Date/Time API − Improved date time API.
- Nashorn, JavaScript Engine − A Java-based engine to execute JavaScript code.
- New tools − New compiler tools and utilities are added like ‘jdeps’ to figure out dependencies. etc.