SlideShare a Scribd company logo
Java SE 9
- SHRINATH JOSHI
Java 9
 Java 9 was released on 21st September 2017
 The main goals for Java 9 are to:
 Make the Java Standard Edition platform, and the JDK, more
navigable to scale down for small computing devices.
 Improve the overall security and maintain not only the JDK but
the Java Implementations in general.
 Allow overall improved application performance.
 Make it easier for Java developers to build and uphold the
code libraries and larger applications, for both the Java SE and
EE Platforms.
Java 9 Features
 Jshell
 JPMS (Java Platform Module System)
 Jlink (Java Linker)
 Http/2 Client API
 Process API Update
 Private method inside interface
Java 9 Features cont..
 Try with resources enhancement
 Factory method to create unmodifiadble collections
 Stream Api enhancements
 < > (Diamond )operator Enhancement
 SafeVargs annotations
 G1GC (Garbage First Garbage collector)
JShell
 Like a playground for Begineers where individual can start
learning without writing the boilerplate code
 The Java Shell tool (JShell) is an interactive tool for learning
the Java programming language and prototyping Java code.
 JShell is a Read-Evaluate-Print Loop (REPL), which evaluates
declarations, statements, and expressions as they are entered
and immediately shows the results.
 The tool is run from the command line.
JPMS
 Until java 8 ,while developing software we first define the
classes, interfaces,enum and put this inside package and then
this packages is kept as Jar file.
 This has few disadvantages eg NoClassDefFoundError,
VersionConflict, Security Problem.
 Untill Java 8, Jdk and Jre had monolithic structure i.e. it cannot
be divided. To execute a simple hello World program of 1 kb
the client had to load 400Mb of JRE on client machine.
 All this problem is also known as Java Hell.
 To overcome this problem JPMS comes into picture
 In modular programming the Jvm checks in the start of
execution where all the required files are present or no
.Therefore there is no Chance of NoclasssDefFoundError.
 Part Of Jigsaw Project
 Project started in 2005
JLink
 To run a simple hello World program we need JRE . JRE
contains rt.jar whose size is 60Mb . This rt.jar contains all the
predefined class i.e it contains 4300+ classes but we required
hardly 5-6 classes . The size of Jre is 400Mb . Therefore to run
1 kb program 400mb is required . Therefore java is heavy
weight.
 To create our own customised jre we use jLink
 We can now use java for Iot deices,micro-services etc.
HTTP/2 Client
 To send an Http request to server from a java program we
need some software and that is http/2 clinet.
 Until java 8 we used httpUrlConnection but this had certain
drawback
 httpUrlconnection was developed in 1997 ,introduced in java
1.0 and was still being used until java 8.
 httpUrlconnection was difficult to use
 Only one request at a time.
 It supported only data in text format and not binary data.
 It works in blocking mode i.e wait for the next request.
 Therefore Java programmer started using Apache Http client
or google Httpclient.
 Now in Java 9 they introduced Http/2 client
 Very easy to use
 Works in both blocking and non blocking mode
 Works with data in both text and binary format
 Can send multiple requests.
Process API Updates
 Java communication with processor is very difficult until java
8, but from java 9 new methods added to Process class i.e Api
got enhanced.
 Most imp feature of java 9
 System.out.println(ProcessHandle.current().pid()); to get the
current running jvm process
Private method inside Interface
 Until 1.7 inside interface wecan take only public and abstract methods and
every variable present inside interface is public static and final
 From 1.8 we can take default methods and static methods
 From 1.9 we can take private methods inside interface
 Without affecting the implementation classes we can extends the
functionality of interface by adding default methods
 Interface inter
 {
 M1();
 M2();
 }
 Class a implements inter
 {
 M1() {}
 M2() {}
 }
 .
 .
 .
 Class class10 implents inter
 {
 M1(){}
 M2(){}
 }
 To add a method in interface we have to make changes in all
the implanting classes .therefor we add default method
 Interface infer
 {
 M1(){}
 M2(){}
 Default void m3(){}
 }
 Implementing classes are not required to override default
methods.
 Private methods in interface are introduced to make code
reuseable
 Without affecting implementation class how we can get Code
Reusablilty?.
 Consider the below code
 Since the method is private it is hidden from the implementing
class
 This make code reusable .
 Interface interface
 {
 Defaulf void m1()
 {
 m3();
 }
 Default void m2()
 {
 m3();
 }
 Private void m3()
 {
 Common code;
 }
 }
Try with Resources enhancement
 Try with resources
 Until 1.6 , if we have to close the resources we wrote that code in finally
block
 From 1.7 try with resources came
 try(r1;r2)
 {
 }
 These resources were closed automatically after the try block.
 Fw fw=new Fw(“abc.txt”);
 Fr fr=new Fr(“input.txt”);
 Try(fw;fr)
 {
 }// Not allowed in Java 8
 // We have to declare inside try()
 From Java 9 we can use try with resources where resources are already
being created
Factory Methods to create
Unmodifiable Collections
 List <String> l =new ArrayList<>();
 L.add(“A”);
 L.add(“B”);
 L.add(“C”);
 Now if I have to make list immutable??
 Until Java 8
 List <String > l2=Collections.unmodifiableList(l);
 From Java 9
 List<String> l=List.of(“A”,”B”,”C”);
 Set.of();
Stream API Enhancement
 Collection is a group of objects.
 The main objective of collection is to hold objects as a single entitiy and
Stream is used to process this object from the collections.
 New Methods in Java 9
 takeWhile() //Default Methods in Stream Interface
 dropWhile() -------- -------
 Stream.iterate() with three argument
 Stream.ofNullable() //to check if null reference
<> Operator
 ArrayList <String> l =new ArrayList<String>();
 Generics is used to perform typesafety and perform and resolve type
casting problems
 From Java 7
 ArrayList <String> l =new ArrayList<>(); // No need to specify the type
parameter
 Also know as type inference
 This <>operator is only applicable for normal classes and not applicable
for Anonymous Inner Classes
 From Java 9 we can use <>(diamond) operator in anonymous inner
classes.
safeVarargs Annotation
 In Java 5 m1(int … x)
 M1(List<String>… x)
 Here there may be a chance of heap Pollution.
 // Warning by compiler
 If we want to supress this warning we can go for safevarargs annotations
 This concept came in java 8 wherein safevarargs is used for static ,final
,constructor methods
 From Java 9 ,it is also used for private methods also
G1GC
Garbage First Garbage collection
 Many type of GC
 Serial Gc
 Parallel GC
 Concurrent mark and Sweep gc
 G1gc //from 1.6
 First three will work based on generations
 G1gc divides the heap into parts and uses the part with most garbage i.e
highest number of objects that are eligible for gc and will destroy that area
 Performance wise g1gc is best
 From Java 9 ,g1gc is default garbage collector
 Untill java 8 , parallel gc was default garbage collector
Thank You

More Related Content

What's hot

Java 8 features
Java 8 featuresJava 8 features
Java 8 features
NexThoughts Technologies
 
Java Presentation For Syntax
Java Presentation For SyntaxJava Presentation For Syntax
Java Presentation For Syntax
PravinYalameli
 
What is Java Technology (An introduction with comparision of .net coding)
What is Java Technology (An introduction with comparision of .net coding)What is Java Technology (An introduction with comparision of .net coding)
What is Java Technology (An introduction with comparision of .net coding)
Shaharyar khan
 
The Java memory model made easy
The Java memory model made easyThe Java memory model made easy
The Java memory model made easy
Rafael Winterhalter
 
Java 8 Feature Preview
Java 8 Feature PreviewJava 8 Feature Preview
Java 8 Feature Preview
Jim Bethancourt
 
Exploring lambdas and invokedynamic for embedded systems
Exploring lambdas and invokedynamic for embedded systemsExploring lambdas and invokedynamic for embedded systems
Exploring lambdas and invokedynamic for embedded systems
InfinIT - Innovationsnetværket for it
 
Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924yohanbeschi
 
Java lab1 manual
Java lab1 manualJava lab1 manual
Java lab1 manual
nahalomar
 
Method Handles in Java
Method Handles in JavaMethod Handles in Java
Method Handles in Java
hendersk
 
PHP 7X New Features
PHP 7X New FeaturesPHP 7X New Features
PHP 7X New Features
Thanh Tai
 
New Features Of JDK 7
New Features Of JDK 7New Features Of JDK 7
New Features Of JDK 7
Deniz Oguz
 
Java programming basics
Java programming basicsJava programming basics
Java programming basics
Hamid Ghorbani
 
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
Raffi Khatchadourian
 
Java Interview Questions by NageswaraRao
Java Interview Questions by NageswaraRaoJava Interview Questions by NageswaraRao
Java Interview Questions by NageswaraRao
JavabynataraJ
 
An Empirical Study of Refactorings and Technical Debt in Machine Learning Sys...
An Empirical Study of Refactorings and Technical Debt in Machine Learning Sys...An Empirical Study of Refactorings and Technical Debt in Machine Learning Sys...
An Empirical Study of Refactorings and Technical Debt in Machine Learning Sys...
Raffi Khatchadourian
 
Bt0074 oops with java2
Bt0074 oops with java2Bt0074 oops with java2
Bt0074 oops with java2
Techglyphs
 
Functional programming
Functional programmingFunctional programming
Functional programming
Lhouceine OUHAMZA
 
Java Concurrency by Example
Java Concurrency by ExampleJava Concurrency by Example
Java Concurrency by Example
Ganesh Samarthyam
 
Introduction to Java programming - Java tutorial for beginners to teach Java ...
Introduction to Java programming - Java tutorial for beginners to teach Java ...Introduction to Java programming - Java tutorial for beginners to teach Java ...
Introduction to Java programming - Java tutorial for beginners to teach Java ...
Duckademy IT courses
 
Introduction to new features in java 8
Introduction to new features in java 8Introduction to new features in java 8
Introduction to new features in java 8
Raffi Khatchadourian
 

What's hot (20)

Java 8 features
Java 8 featuresJava 8 features
Java 8 features
 
Java Presentation For Syntax
Java Presentation For SyntaxJava Presentation For Syntax
Java Presentation For Syntax
 
What is Java Technology (An introduction with comparision of .net coding)
What is Java Technology (An introduction with comparision of .net coding)What is Java Technology (An introduction with comparision of .net coding)
What is Java Technology (An introduction with comparision of .net coding)
 
The Java memory model made easy
The Java memory model made easyThe Java memory model made easy
The Java memory model made easy
 
Java 8 Feature Preview
Java 8 Feature PreviewJava 8 Feature Preview
Java 8 Feature Preview
 
Exploring lambdas and invokedynamic for embedded systems
Exploring lambdas and invokedynamic for embedded systemsExploring lambdas and invokedynamic for embedded systems
Exploring lambdas and invokedynamic for embedded systems
 
Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924
 
Java lab1 manual
Java lab1 manualJava lab1 manual
Java lab1 manual
 
Method Handles in Java
Method Handles in JavaMethod Handles in Java
Method Handles in Java
 
PHP 7X New Features
PHP 7X New FeaturesPHP 7X New Features
PHP 7X New Features
 
New Features Of JDK 7
New Features Of JDK 7New Features Of JDK 7
New Features Of JDK 7
 
Java programming basics
Java programming basicsJava programming basics
Java programming basics
 
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
 
Java Interview Questions by NageswaraRao
Java Interview Questions by NageswaraRaoJava Interview Questions by NageswaraRao
Java Interview Questions by NageswaraRao
 
An Empirical Study of Refactorings and Technical Debt in Machine Learning Sys...
An Empirical Study of Refactorings and Technical Debt in Machine Learning Sys...An Empirical Study of Refactorings and Technical Debt in Machine Learning Sys...
An Empirical Study of Refactorings and Technical Debt in Machine Learning Sys...
 
Bt0074 oops with java2
Bt0074 oops with java2Bt0074 oops with java2
Bt0074 oops with java2
 
Functional programming
Functional programmingFunctional programming
Functional programming
 
Java Concurrency by Example
Java Concurrency by ExampleJava Concurrency by Example
Java Concurrency by Example
 
Introduction to Java programming - Java tutorial for beginners to teach Java ...
Introduction to Java programming - Java tutorial for beginners to teach Java ...Introduction to Java programming - Java tutorial for beginners to teach Java ...
Introduction to Java programming - Java tutorial for beginners to teach Java ...
 
Introduction to new features in java 8
Introduction to new features in java 8Introduction to new features in java 8
Introduction to new features in java 8
 

Similar to Java 9 features

Java 8 Overview
Java 8 OverviewJava 8 Overview
Java 8 Overview
Nicola Pedot
 
java basic for begginers
java basic for begginersjava basic for begginers
java basic for begginers
divaskrgupta007
 
Java for Mainframers
Java for MainframersJava for Mainframers
Java for Mainframers
Rich Helton
 
Introduction
IntroductionIntroduction
Introduction
richsoden
 
CORE JAVA
CORE JAVACORE JAVA
Java7
Java7Java7
Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...
Mr. Akaash
 
1.introduction to java
1.introduction to java1.introduction to java
1.introduction to java
Madhura Bhalerao
 
Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...
Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...
Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...
Sagar Verma
 
Unit of competency
Unit of competencyUnit of competency
Unit of competency
loidasacueza
 
Java/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCJava/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBC
FAKHRUN NISHA
 
Java programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruJava programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, Mysuru
Nithin Kumar,VVCE, Mysuru
 
OOP-Chap2.docx
OOP-Chap2.docxOOP-Chap2.docx
OOP-Chap2.docx
NaorinHalim
 
Java 9 Features
Java 9 FeaturesJava 9 Features
Java 9 Features
NexThoughts Technologies
 
Java
JavaJava
Chapter 2.1
Chapter 2.1Chapter 2.1
Chapter 2.1sotlsoc
 

Similar to Java 9 features (20)

Java 8 Overview
Java 8 OverviewJava 8 Overview
Java 8 Overview
 
java basic for begginers
java basic for begginersjava basic for begginers
java basic for begginers
 
Java for Mainframers
Java for MainframersJava for Mainframers
Java for Mainframers
 
Introduction
IntroductionIntroduction
Introduction
 
CORE JAVA
CORE JAVACORE JAVA
CORE JAVA
 
Java7
Java7Java7
Java7
 
Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...Introduction to Java Programming, Basic Structure, variables Data type, input...
Introduction to Java Programming, Basic Structure, variables Data type, input...
 
Basic java part_ii
Basic java part_iiBasic java part_ii
Basic java part_ii
 
1.introduction to java
1.introduction to java1.introduction to java
1.introduction to java
 
Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...
Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...
Java Class 6 | Java Class 6 |Threads in Java| Applets | Swing GUI | JDBC | Ac...
 
Unit of competency
Unit of competencyUnit of competency
Unit of competency
 
OOPS JAVA.pdf
OOPS JAVA.pdfOOPS JAVA.pdf
OOPS JAVA.pdf
 
Java/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCJava/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBC
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
 
Java programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, MysuruJava programming material for beginners by Nithin, VVCE, Mysuru
Java programming material for beginners by Nithin, VVCE, Mysuru
 
OOP-Chap2.docx
OOP-Chap2.docxOOP-Chap2.docx
OOP-Chap2.docx
 
Java 9 Features
Java 9 FeaturesJava 9 Features
Java 9 Features
 
Javalecture 1
Javalecture 1Javalecture 1
Javalecture 1
 
Java
JavaJava
Java
 
Chapter 2.1
Chapter 2.1Chapter 2.1
Chapter 2.1
 

Recently uploaded

BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 

Recently uploaded (20)

BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 

Java 9 features

  • 1. Java SE 9 - SHRINATH JOSHI
  • 2. Java 9  Java 9 was released on 21st September 2017  The main goals for Java 9 are to:  Make the Java Standard Edition platform, and the JDK, more navigable to scale down for small computing devices.  Improve the overall security and maintain not only the JDK but the Java Implementations in general.  Allow overall improved application performance.  Make it easier for Java developers to build and uphold the code libraries and larger applications, for both the Java SE and EE Platforms.
  • 3. Java 9 Features  Jshell  JPMS (Java Platform Module System)  Jlink (Java Linker)  Http/2 Client API  Process API Update  Private method inside interface
  • 4. Java 9 Features cont..  Try with resources enhancement  Factory method to create unmodifiadble collections  Stream Api enhancements  < > (Diamond )operator Enhancement  SafeVargs annotations  G1GC (Garbage First Garbage collector)
  • 5. JShell  Like a playground for Begineers where individual can start learning without writing the boilerplate code  The Java Shell tool (JShell) is an interactive tool for learning the Java programming language and prototyping Java code.  JShell is a Read-Evaluate-Print Loop (REPL), which evaluates declarations, statements, and expressions as they are entered and immediately shows the results.  The tool is run from the command line.
  • 6. JPMS  Until java 8 ,while developing software we first define the classes, interfaces,enum and put this inside package and then this packages is kept as Jar file.  This has few disadvantages eg NoClassDefFoundError, VersionConflict, Security Problem.  Untill Java 8, Jdk and Jre had monolithic structure i.e. it cannot be divided. To execute a simple hello World program of 1 kb the client had to load 400Mb of JRE on client machine.  All this problem is also known as Java Hell.  To overcome this problem JPMS comes into picture
  • 7.  In modular programming the Jvm checks in the start of execution where all the required files are present or no .Therefore there is no Chance of NoclasssDefFoundError.  Part Of Jigsaw Project  Project started in 2005
  • 8. JLink  To run a simple hello World program we need JRE . JRE contains rt.jar whose size is 60Mb . This rt.jar contains all the predefined class i.e it contains 4300+ classes but we required hardly 5-6 classes . The size of Jre is 400Mb . Therefore to run 1 kb program 400mb is required . Therefore java is heavy weight.  To create our own customised jre we use jLink  We can now use java for Iot deices,micro-services etc.
  • 9. HTTP/2 Client  To send an Http request to server from a java program we need some software and that is http/2 clinet.  Until java 8 we used httpUrlConnection but this had certain drawback  httpUrlconnection was developed in 1997 ,introduced in java 1.0 and was still being used until java 8.  httpUrlconnection was difficult to use  Only one request at a time.  It supported only data in text format and not binary data.  It works in blocking mode i.e wait for the next request.
  • 10.  Therefore Java programmer started using Apache Http client or google Httpclient.  Now in Java 9 they introduced Http/2 client  Very easy to use  Works in both blocking and non blocking mode  Works with data in both text and binary format  Can send multiple requests.
  • 11. Process API Updates  Java communication with processor is very difficult until java 8, but from java 9 new methods added to Process class i.e Api got enhanced.  Most imp feature of java 9  System.out.println(ProcessHandle.current().pid()); to get the current running jvm process
  • 12. Private method inside Interface  Until 1.7 inside interface wecan take only public and abstract methods and every variable present inside interface is public static and final  From 1.8 we can take default methods and static methods  From 1.9 we can take private methods inside interface  Without affecting the implementation classes we can extends the functionality of interface by adding default methods  Interface inter  {  M1();  M2();  }
  • 13.  Class a implements inter  {  M1() {}  M2() {}  }  .  .  .  Class class10 implents inter  {  M1(){}  M2(){}  }
  • 14.  To add a method in interface we have to make changes in all the implanting classes .therefor we add default method  Interface infer  {  M1(){}  M2(){}  Default void m3(){}  }  Implementing classes are not required to override default methods.
  • 15.  Private methods in interface are introduced to make code reuseable  Without affecting implementation class how we can get Code Reusablilty?.  Consider the below code  Since the method is private it is hidden from the implementing class  This make code reusable .
  • 16.  Interface interface  {  Defaulf void m1()  {  m3();  }  Default void m2()  {  m3();  }  Private void m3()  {  Common code;  }  }
  • 17. Try with Resources enhancement  Try with resources  Until 1.6 , if we have to close the resources we wrote that code in finally block  From 1.7 try with resources came  try(r1;r2)  {  }  These resources were closed automatically after the try block.
  • 18.  Fw fw=new Fw(“abc.txt”);  Fr fr=new Fr(“input.txt”);  Try(fw;fr)  {  }// Not allowed in Java 8  // We have to declare inside try()  From Java 9 we can use try with resources where resources are already being created
  • 19. Factory Methods to create Unmodifiable Collections  List <String> l =new ArrayList<>();  L.add(“A”);  L.add(“B”);  L.add(“C”);  Now if I have to make list immutable??  Until Java 8  List <String > l2=Collections.unmodifiableList(l);  From Java 9  List<String> l=List.of(“A”,”B”,”C”);  Set.of();
  • 20. Stream API Enhancement  Collection is a group of objects.  The main objective of collection is to hold objects as a single entitiy and Stream is used to process this object from the collections.  New Methods in Java 9  takeWhile() //Default Methods in Stream Interface  dropWhile() -------- -------  Stream.iterate() with three argument  Stream.ofNullable() //to check if null reference
  • 21. <> Operator  ArrayList <String> l =new ArrayList<String>();  Generics is used to perform typesafety and perform and resolve type casting problems  From Java 7  ArrayList <String> l =new ArrayList<>(); // No need to specify the type parameter  Also know as type inference  This <>operator is only applicable for normal classes and not applicable for Anonymous Inner Classes  From Java 9 we can use <>(diamond) operator in anonymous inner classes.
  • 22. safeVarargs Annotation  In Java 5 m1(int … x)  M1(List<String>… x)  Here there may be a chance of heap Pollution.  // Warning by compiler  If we want to supress this warning we can go for safevarargs annotations  This concept came in java 8 wherein safevarargs is used for static ,final ,constructor methods  From Java 9 ,it is also used for private methods also
  • 23. G1GC Garbage First Garbage collection  Many type of GC  Serial Gc  Parallel GC  Concurrent mark and Sweep gc  G1gc //from 1.6  First three will work based on generations  G1gc divides the heap into parts and uses the part with most garbage i.e highest number of objects that are eligible for gc and will destroy that area  Performance wise g1gc is best  From Java 9 ,g1gc is default garbage collector  Untill java 8 , parallel gc was default garbage collector