SlideShare a Scribd company logo
1 of 34
Download to read offline
New Features
Haim Michael
June 4th
, 2019
All logos, trade marks and brand names used in this presentation belong
to the respective owners.
lifemichael
Java 11
1st Part https://youtu.be/zggphqAcUvw
2nd Part https://youtu.be/ViL0flSGrGY
© 1996-2018 All Rights Reserved.
Haim Michael Introduction
● Snowboarding. Learning. Coding. Teaching. More
than 20 years of Practical Experience.
lifemichael
© 1996-2018 All Rights Reserved.
Haim Michael Introduction
● Professional Certifications
Zend Certified Engineer in PHP
Certified Java Professional
Certified Java EE Web Component Developer
OMG Certified UML Professional
● MBA (cum laude) from Tel-Aviv University
Information Systems Management
lifemichael
© 2008 Haim Michael 20151026
Oracle JDK is not Free
 As of Java 11, the Oracle JDK would no longer be free
for commercial use.
 The Open JDK continues to be free. We can use it
instead. However, we won't get nor security updates
and nor any update at all.
© 2008 Haim Michael 20151026
Running Java File
 We can avoid the compilation phase. We can compile
and execute in one command. We use the java
command. It will implicitly compile without saving the
.class file.
© 2008 Haim Michael 20151026
Running Java File
© 2008 Haim Michael 20151026
Java String Methods
 The isBlank() method checks whether the string is
an empty string, meaning... whether the string solely
includes zero or more blanks. String with only white
characters is treated as a blank string.
public class Program {
public static void main(String args[]) {
var a = "";
var b = " ";
System.out.println(a.isBlank());
System.out.println(b.isBlank());
}
}
© 2008 Haim Michael 20151026
Java String Methods
 The lines() method returns a reference for a stream
of strings that are substrings we received after splitting
by lines.
public class Program {
public static void main(String args[]) {
var a = "wenlovenjavanandnkotlin";
var stream = a.lines();
stream.forEach(str->System.out.println(str));
}
}
© 2008 Haim Michael 20151026
Java String Methods
 The strip(), stripLeading()and the
stripTrailing methods remove white spaces from
the beginning, the ending and the remr of the string. It
is a 'Unicode-Aware' evolution of trim();
public class Program {
public static void main(String args[]) {
var a = " we love kotlin ";
var b = a.strip();
System.out.println("###"+b+"###");
}
}
© 2008 Haim Michael 20151026
Java String Methods
 The repeat() method repeats the string on which it is
invoked the number of times it receives.
public class Program {
public static void main(String args[]) {
var a = "love ";
var b = a.repeat(2);
System.out.println(b);
}
}
© 2008 Haim Michael 20151026
Using var in Lambda Expressions
 As of Java 11 we can use the var keyword within
lambda expressions.
interface Calculation {
public int calc(int a,int b);
}
public class Program {
public static void main(String args[]) {
Calculation f = (var a, var b)-> a+b;
System.out.println(f.calc(4,5));
}
}
© 2008 Haim Michael 20151026
Using var in Lambda Expressions
 When using var in a lambda expression we must use
it on all parameters and we cannot mix it with using
specific types.
© 2008 Haim Michael 20151026
Inner Classes Access Control
 Code written in methods defined inside inner class can
access members of the outer class, even if these
members are private.
class Outer
{
private void a() {}
class Inner {
void b() {
a();
}
}
}
© 2008 Haim Michael 20151026
Inner Classes Access Control
 As of Java 11, there are new methods in Class class
that assist us with getting information about the created
nest. These methods include the following:
getNestHost(), getNestMembers() and
isNestemateOf().
© 2008 Haim Michael 20151026
Epsilon
 As of Java 11, the JVM has an experimental feature
that allows us to run the JVM without any actual
memory reclamation.
 The goal is to provide a completely passive garbage
collector implementation with a bounded allocation limit
and the lowest latency overhead possible.
https://openjdk.java.net/jeps/318
© 2008 Haim Michael 20151026
Deprecated Modules Removal
 As of Java 11, Java EE and CORBA modules that
were already marked as deprecated in Java 9 are now
completely removed.
java.xml.ws
java.xml.bind
java.activation
java.xml.ws.annotation
java.corba
java.transaction
java.se.ee
jdk.xml.ws
jdk.xml.bind
© 2008 Haim Michael 20151026
Flight Recorder
 The Flight Recorder is a profiling tool with a negligible
overhead below 1%. This extra ordinary overhead
allows us to use it even in production.
 The Flight Recorder, also known as JFR, used to be a
commercial add-on in Oracle JDK. It was recently open
sourced.
© 2008 Haim Michael 20151026
Flight Recorder
 Using the jps command we can get the process id of
our Java program.
© 2008 Haim Michael 20151026
Flight Recorder
 Using the jcmd command we can perform various
commands, such as jcmd 43659 JFR.start
© 2008 Haim Michael 20151026
Flight Recorder
 Using the jcmd command together with JFR.dump we
can dump all data to a textual file we choose its name
and it location on our computer.
© 2008 Haim Michael 20151026
Flight Recorder
 There are various possibilities to process the new
created data file.
https://github.com/lhotari/jfr-report-tool
© 2008 Haim Michael 20151026
The HTTP Client
 As of Java 11, the HTTP Client API is more
standardized.
 The new API supports both HTTP/1.1 and HTTP/2.
 The new API also supports HTML5 WebSockets.
© 2008 Haim Michael 20151026
The HTTP Client
 As of Java 11, the HTTP Client API is more
standardized. The new API supports both HTTP/1.1
and HTTP/2. The new API also supports HTML5
WebSockets.
© 2008 Haim Michael 20151026
The HTTP Client
package com.lifemichael.samples;
import java.io.IOException;
import java.net.http.*;
import java.net.*;
import java.net.http.HttpResponse.*;
public class HTTPClientDemo {
public static void main(String args[]) {
HttpClient httpClient = HttpClient.newBuilder().build();
© 2008 Haim Michael 20151026
The HTTP Client
HttpRequest request = HttpRequest.newBuilder().uri(URI.create(
"http://www.abelski.com/courses/dom/lib_doc.xml"))
.GET()
.build();
try {
HttpResponse<String> response = httpClient.send(
request, BodyHandlers.ofString());
System.out.println(response.body());
System.out.println(response.statusCode());
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
© 2008 Haim Michael 20151026
The HTTP Client
 The new HTTP Client allows us to initiate an
asynchronous HTTP request.
HttpClient
.sendAsync(request,BodyHandlers.ofString())
.thenAccept(response -> {
System.out.println(response.body());
//..
});
© 2008 Haim Michael 20151026
The HTTP Client
 The new HTTP Client supports the WebSocket
protocol.
HttpClient httpClient = HttpClient.newBuilder()
.executor(executor).build();
Builder webSocketBuilder = httpClient.newWebSocketBuilder();
WebSocket webSocket = webSocketBuilder
.buildAsync(
URI.create("wss://echo.websocket.org"), … ).join();
© 2008 Haim Michael 20151026
Nashorn is Deprecated
 As of Java 11, the Nashorn JavaScript engine and
APIs are deprecated. Most likely, in future versions of
the JDK.
© 2008 Haim Michael 20151026
The ZGC Scalable Low Latency GC
 As of Java 11, we can use the ZGC. This new GC is
available as an experimental feature.
 ZGC is a scalable low latency garbage collector. It
performs the expensive work concurrently without
stopping the execution of application threads for more
than 10ms.
© 2008 Haim Michael 20151026
The ZGC Scalable Low Latency GC
 ZGC is suitable especially for applications that require
low latency and/or use a very large heap (multi-
terabytes).
© 2008 Haim Michael 20151026
Files Reading and Writing
 Java 11 introduces two new methods that significantly
assist with reading and writing strings from and to files.
readString()
writeString()
© 2008 Haim Michael 20151026
Files Reading and Writing
public class FilesReadingDemo {
public static void main(String args[]) {
try {
Path path = FileSystems.getDefault()
.getPath(".", "welove.txt");
String str = Files.readString(path);
System.out.println(str);
} catch (IOException e) {
e.printStackTrace();
}
}
© 2008 Haim Michael 20151026
Files Reading and Writing
public class FilesWritingDemo {
public static void main(String args[]) {
Path path = FileSystems.getDefault()
.getPath(".", "welove.txt");
try {
Files.writeString(path,
"we love php", StandardOpenOption.APPEND);
} catch (IOException e) {
e.printStackTrace();
}
}
}
© 2008 Haim Michael 20151026
Q&A
Thanks for attending our meetup! I hope you enjoyed! I
will be more than happy to get feedback.
Haim Michael
haim.michael@lifemichael.com
0546655837

More Related Content

What's hot

Migrating to Java 11
Migrating to Java 11Migrating to Java 11
Migrating to Java 11Arto Santala
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework Serhat Can
 
Angular 8
Angular 8 Angular 8
Angular 8 Sunil OS
 
Deep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UKDeep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UKJosé Paumard
 
Java 9/10/11 - What's new and why you should upgrade
Java 9/10/11 - What's new and why you should upgradeJava 9/10/11 - What's new and why you should upgrade
Java 9/10/11 - What's new and why you should upgradeSimone Bordet
 
Java Tutorial For Beginners - Step By Step | Java Basics | Java Certification...
Java Tutorial For Beginners - Step By Step | Java Basics | Java Certification...Java Tutorial For Beginners - Step By Step | Java Basics | Java Certification...
Java Tutorial For Beginners - Step By Step | Java Basics | Java Certification...Edureka!
 
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
 
Clean Code II - Dependency Injection
Clean Code II - Dependency InjectionClean Code II - Dependency Injection
Clean Code II - Dependency InjectionTheo Jungeblut
 
Building RESTful applications using Spring MVC
Building RESTful applications using Spring MVCBuilding RESTful applications using Spring MVC
Building RESTful applications using Spring MVCIndicThreads
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation ToolIzzet Mustafaiev
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot IntroductionJeevesh Pandey
 

What's hot (20)

Migrating to Java 11
Migrating to Java 11Migrating to Java 11
Migrating to Java 11
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Angular 8
Angular 8 Angular 8
Angular 8
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
 
Core java
Core javaCore java
Core java
 
Spring boot
Spring bootSpring boot
Spring boot
 
Java Programming
Java ProgrammingJava Programming
Java Programming
 
Deep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UKDeep Dive Java 17 Devoxx UK
Deep Dive Java 17 Devoxx UK
 
Java 9/10/11 - What's new and why you should upgrade
Java 9/10/11 - What's new and why you should upgradeJava 9/10/11 - What's new and why you should upgrade
Java 9/10/11 - What's new and why you should upgrade
 
Introduction to java 8 stream api
Introduction to java 8 stream apiIntroduction to java 8 stream api
Introduction to java 8 stream api
 
Java Tutorial For Beginners - Step By Step | Java Basics | Java Certification...
Java Tutorial For Beginners - Step By Step | Java Basics | Java Certification...Java Tutorial For Beginners - Step By Step | Java Basics | Java Certification...
Java Tutorial For Beginners - Step By Step | Java Basics | Java Certification...
 
Core java Essentials
Core java EssentialsCore java Essentials
Core java Essentials
 
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...
 
Clean Code II - Dependency Injection
Clean Code II - Dependency InjectionClean Code II - Dependency Injection
Clean Code II - Dependency Injection
 
Building RESTful applications using Spring MVC
Building RESTful applications using Spring MVCBuilding RESTful applications using Spring MVC
Building RESTful applications using Spring MVC
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation Tool
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
 
Laravel Eloquent ORM
Laravel Eloquent ORMLaravel Eloquent ORM
Laravel Eloquent ORM
 
Java 8 Lambda and Streams
Java 8 Lambda and StreamsJava 8 Lambda and Streams
Java 8 Lambda and Streams
 
Spring MVC Framework
Spring MVC FrameworkSpring MVC Framework
Spring MVC Framework
 

Similar to Java11 New Features

Asynchronous JavaScript Programming
Asynchronous JavaScript ProgrammingAsynchronous JavaScript Programming
Asynchronous JavaScript ProgrammingHaim Michael
 
Introduction to JavaFX on Raspberry Pi
Introduction to JavaFX on Raspberry PiIntroduction to JavaFX on Raspberry Pi
Introduction to JavaFX on Raspberry PiBruno Borges
 
Mastering the Sling Rewriter by Justin Edelson
Mastering the Sling Rewriter by Justin EdelsonMastering the Sling Rewriter by Justin Edelson
Mastering the Sling Rewriter by Justin EdelsonAEM HUB
 
Mastering the Sling Rewriter
Mastering the Sling RewriterMastering the Sling Rewriter
Mastering the Sling RewriterJustin Edelson
 
Node.js primer for ITE students
Node.js primer for ITE studentsNode.js primer for ITE students
Node.js primer for ITE studentsQuhan Arunasalam
 
Traffic Management In The Cloud
Traffic Management In The CloudTraffic Management In The Cloud
Traffic Management In The CloudIntel Corporation
 
Java and Serverless - A Match Made In Heaven, Part 2
Java and Serverless - A Match Made In Heaven, Part 2Java and Serverless - A Match Made In Heaven, Part 2
Java and Serverless - A Match Made In Heaven, Part 2Curity
 
JavaFX8 TestFX - CDI
JavaFX8   TestFX - CDIJavaFX8   TestFX - CDI
JavaFX8 TestFX - CDISven Ruppert
 
Node JS Crash Course
Node JS Crash CourseNode JS Crash Course
Node JS Crash CourseHaim Michael
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to javaciklum_ods
 
Node.js Crash Course (Jump Start)
Node.js Crash Course (Jump Start) Node.js Crash Course (Jump Start)
Node.js Crash Course (Jump Start) Haim Michael
 
Java rmi example program with code
Java rmi example program with codeJava rmi example program with code
Java rmi example program with codekamal kotecha
 
Open Source XMPP for Cloud Services
Open Source XMPP for Cloud ServicesOpen Source XMPP for Cloud Services
Open Source XMPP for Cloud Servicesmattjive
 
Maximize the power of OSGi in AEM
Maximize the power of OSGi in AEM Maximize the power of OSGi in AEM
Maximize the power of OSGi in AEM ICF CIRCUIT
 
Java 9 features
Java 9 featuresJava 9 features
Java 9 featuresshrinath97
 
Networking and Data Access with Eqela
Networking and Data Access with EqelaNetworking and Data Access with Eqela
Networking and Data Access with Eqelajobandesther
 
InterConnect2016: WebApp Architectures with Java and Node.js
InterConnect2016: WebApp Architectures with Java and Node.jsInterConnect2016: WebApp Architectures with Java and Node.js
InterConnect2016: WebApp Architectures with Java and Node.jsChris Bailey
 
Java vs. Java Script for enterprise web applications - Chris Bailey
Java vs. Java Script for enterprise web applications - Chris BaileyJava vs. Java Script for enterprise web applications - Chris Bailey
Java vs. Java Script for enterprise web applications - Chris BaileyJAXLondon_Conference
 

Similar to Java11 New Features (20)

Asynchronous JavaScript Programming
Asynchronous JavaScript ProgrammingAsynchronous JavaScript Programming
Asynchronous JavaScript Programming
 
Introduction to JavaFX on Raspberry Pi
Introduction to JavaFX on Raspberry PiIntroduction to JavaFX on Raspberry Pi
Introduction to JavaFX on Raspberry Pi
 
Mastering the Sling Rewriter by Justin Edelson
Mastering the Sling Rewriter by Justin EdelsonMastering the Sling Rewriter by Justin Edelson
Mastering the Sling Rewriter by Justin Edelson
 
Mastering the Sling Rewriter
Mastering the Sling RewriterMastering the Sling Rewriter
Mastering the Sling Rewriter
 
Node.js primer for ITE students
Node.js primer for ITE studentsNode.js primer for ITE students
Node.js primer for ITE students
 
Traffic Management In The Cloud
Traffic Management In The CloudTraffic Management In The Cloud
Traffic Management In The Cloud
 
Java and Serverless - A Match Made In Heaven, Part 2
Java and Serverless - A Match Made In Heaven, Part 2Java and Serverless - A Match Made In Heaven, Part 2
Java and Serverless - A Match Made In Heaven, Part 2
 
JavaFX8 TestFX - CDI
JavaFX8   TestFX - CDIJavaFX8   TestFX - CDI
JavaFX8 TestFX - CDI
 
Node JS Crash Course
Node JS Crash CourseNode JS Crash Course
Node JS Crash Course
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
 
Node.js Crash Course (Jump Start)
Node.js Crash Course (Jump Start) Node.js Crash Course (Jump Start)
Node.js Crash Course (Jump Start)
 
Java rmi example program with code
Java rmi example program with codeJava rmi example program with code
Java rmi example program with code
 
Open Source XMPP for Cloud Services
Open Source XMPP for Cloud ServicesOpen Source XMPP for Cloud Services
Open Source XMPP for Cloud Services
 
Maximize the power of OSGi in AEM
Maximize the power of OSGi in AEM Maximize the power of OSGi in AEM
Maximize the power of OSGi in AEM
 
Node.js primer
Node.js primerNode.js primer
Node.js primer
 
Java 9 features
Java 9 featuresJava 9 features
Java 9 features
 
Networking and Data Access with Eqela
Networking and Data Access with EqelaNetworking and Data Access with Eqela
Networking and Data Access with Eqela
 
Node.js Workshop
Node.js WorkshopNode.js Workshop
Node.js Workshop
 
InterConnect2016: WebApp Architectures with Java and Node.js
InterConnect2016: WebApp Architectures with Java and Node.jsInterConnect2016: WebApp Architectures with Java and Node.js
InterConnect2016: WebApp Architectures with Java and Node.js
 
Java vs. Java Script for enterprise web applications - Chris Bailey
Java vs. Java Script for enterprise web applications - Chris BaileyJava vs. Java Script for enterprise web applications - Chris Bailey
Java vs. Java Script for enterprise web applications - Chris Bailey
 

More from Haim Michael

Virtual Threads in Java
Virtual Threads in JavaVirtual Threads in Java
Virtual Threads in JavaHaim Michael
 
MongoDB Design Patterns
MongoDB Design PatternsMongoDB Design Patterns
MongoDB Design PatternsHaim Michael
 
Introduction to SQL Injections
Introduction to SQL InjectionsIntroduction to SQL Injections
Introduction to SQL InjectionsHaim Michael
 
Record Classes in Java
Record Classes in JavaRecord Classes in Java
Record Classes in JavaHaim Michael
 
Microservices Design Patterns
Microservices Design PatternsMicroservices Design Patterns
Microservices Design PatternsHaim Michael
 
Structural Pattern Matching in Python
Structural Pattern Matching in PythonStructural Pattern Matching in Python
Structural Pattern Matching in PythonHaim Michael
 
Unit Testing in Python
Unit Testing in PythonUnit Testing in Python
Unit Testing in PythonHaim Michael
 
OOP Best Practices in JavaScript
OOP Best Practices in JavaScriptOOP Best Practices in JavaScript
OOP Best Practices in JavaScriptHaim Michael
 
JavaScript Jump Start 20220214
JavaScript Jump Start 20220214JavaScript Jump Start 20220214
JavaScript Jump Start 20220214Haim Michael
 
Bootstrap Jump Start
Bootstrap Jump StartBootstrap Jump Start
Bootstrap Jump StartHaim Michael
 
What is new in PHP
What is new in PHPWhat is new in PHP
What is new in PHPHaim Michael
 
What is new in Python 3.9
What is new in Python 3.9What is new in Python 3.9
What is new in Python 3.9Haim Michael
 
Programming in Python on Steroid
Programming in Python on SteroidProgramming in Python on Steroid
Programming in Python on SteroidHaim Michael
 
The matplotlib Library
The matplotlib LibraryThe matplotlib Library
The matplotlib LibraryHaim Michael
 
Pandas meetup 20200908
Pandas meetup 20200908Pandas meetup 20200908
Pandas meetup 20200908Haim Michael
 
The num py_library_20200818
The num py_library_20200818The num py_library_20200818
The num py_library_20200818Haim Michael
 
Jupyter notebook 20200728
Jupyter notebook 20200728Jupyter notebook 20200728
Jupyter notebook 20200728Haim Michael
 
The Power of Decorators in Python [Meetup]
The Power of Decorators in Python [Meetup]The Power of Decorators in Python [Meetup]
The Power of Decorators in Python [Meetup]Haim Michael
 

More from Haim Michael (20)

Anti Patterns
Anti PatternsAnti Patterns
Anti Patterns
 
Virtual Threads in Java
Virtual Threads in JavaVirtual Threads in Java
Virtual Threads in Java
 
MongoDB Design Patterns
MongoDB Design PatternsMongoDB Design Patterns
MongoDB Design Patterns
 
Introduction to SQL Injections
Introduction to SQL InjectionsIntroduction to SQL Injections
Introduction to SQL Injections
 
Record Classes in Java
Record Classes in JavaRecord Classes in Java
Record Classes in Java
 
Microservices Design Patterns
Microservices Design PatternsMicroservices Design Patterns
Microservices Design Patterns
 
Structural Pattern Matching in Python
Structural Pattern Matching in PythonStructural Pattern Matching in Python
Structural Pattern Matching in Python
 
Unit Testing in Python
Unit Testing in PythonUnit Testing in Python
Unit Testing in Python
 
OOP Best Practices in JavaScript
OOP Best Practices in JavaScriptOOP Best Practices in JavaScript
OOP Best Practices in JavaScript
 
Java Jump Start
Java Jump StartJava Jump Start
Java Jump Start
 
JavaScript Jump Start 20220214
JavaScript Jump Start 20220214JavaScript Jump Start 20220214
JavaScript Jump Start 20220214
 
Bootstrap Jump Start
Bootstrap Jump StartBootstrap Jump Start
Bootstrap Jump Start
 
What is new in PHP
What is new in PHPWhat is new in PHP
What is new in PHP
 
What is new in Python 3.9
What is new in Python 3.9What is new in Python 3.9
What is new in Python 3.9
 
Programming in Python on Steroid
Programming in Python on SteroidProgramming in Python on Steroid
Programming in Python on Steroid
 
The matplotlib Library
The matplotlib LibraryThe matplotlib Library
The matplotlib Library
 
Pandas meetup 20200908
Pandas meetup 20200908Pandas meetup 20200908
Pandas meetup 20200908
 
The num py_library_20200818
The num py_library_20200818The num py_library_20200818
The num py_library_20200818
 
Jupyter notebook 20200728
Jupyter notebook 20200728Jupyter notebook 20200728
Jupyter notebook 20200728
 
The Power of Decorators in Python [Meetup]
The Power of Decorators in Python [Meetup]The Power of Decorators in Python [Meetup]
The Power of Decorators in Python [Meetup]
 

Recently uploaded

The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456KiaraTiradoMicha
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxalwaysnagaraju26
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 

Recently uploaded (20)

The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 

Java11 New Features

  • 1. New Features Haim Michael June 4th , 2019 All logos, trade marks and brand names used in this presentation belong to the respective owners. lifemichael Java 11 1st Part https://youtu.be/zggphqAcUvw 2nd Part https://youtu.be/ViL0flSGrGY
  • 2. © 1996-2018 All Rights Reserved. Haim Michael Introduction ● Snowboarding. Learning. Coding. Teaching. More than 20 years of Practical Experience. lifemichael
  • 3. © 1996-2018 All Rights Reserved. Haim Michael Introduction ● Professional Certifications Zend Certified Engineer in PHP Certified Java Professional Certified Java EE Web Component Developer OMG Certified UML Professional ● MBA (cum laude) from Tel-Aviv University Information Systems Management lifemichael
  • 4. © 2008 Haim Michael 20151026 Oracle JDK is not Free  As of Java 11, the Oracle JDK would no longer be free for commercial use.  The Open JDK continues to be free. We can use it instead. However, we won't get nor security updates and nor any update at all.
  • 5. © 2008 Haim Michael 20151026 Running Java File  We can avoid the compilation phase. We can compile and execute in one command. We use the java command. It will implicitly compile without saving the .class file.
  • 6. © 2008 Haim Michael 20151026 Running Java File
  • 7. © 2008 Haim Michael 20151026 Java String Methods  The isBlank() method checks whether the string is an empty string, meaning... whether the string solely includes zero or more blanks. String with only white characters is treated as a blank string. public class Program { public static void main(String args[]) { var a = ""; var b = " "; System.out.println(a.isBlank()); System.out.println(b.isBlank()); } }
  • 8. © 2008 Haim Michael 20151026 Java String Methods  The lines() method returns a reference for a stream of strings that are substrings we received after splitting by lines. public class Program { public static void main(String args[]) { var a = "wenlovenjavanandnkotlin"; var stream = a.lines(); stream.forEach(str->System.out.println(str)); } }
  • 9. © 2008 Haim Michael 20151026 Java String Methods  The strip(), stripLeading()and the stripTrailing methods remove white spaces from the beginning, the ending and the remr of the string. It is a 'Unicode-Aware' evolution of trim(); public class Program { public static void main(String args[]) { var a = " we love kotlin "; var b = a.strip(); System.out.println("###"+b+"###"); } }
  • 10. © 2008 Haim Michael 20151026 Java String Methods  The repeat() method repeats the string on which it is invoked the number of times it receives. public class Program { public static void main(String args[]) { var a = "love "; var b = a.repeat(2); System.out.println(b); } }
  • 11. © 2008 Haim Michael 20151026 Using var in Lambda Expressions  As of Java 11 we can use the var keyword within lambda expressions. interface Calculation { public int calc(int a,int b); } public class Program { public static void main(String args[]) { Calculation f = (var a, var b)-> a+b; System.out.println(f.calc(4,5)); } }
  • 12. © 2008 Haim Michael 20151026 Using var in Lambda Expressions  When using var in a lambda expression we must use it on all parameters and we cannot mix it with using specific types.
  • 13. © 2008 Haim Michael 20151026 Inner Classes Access Control  Code written in methods defined inside inner class can access members of the outer class, even if these members are private. class Outer { private void a() {} class Inner { void b() { a(); } } }
  • 14. © 2008 Haim Michael 20151026 Inner Classes Access Control  As of Java 11, there are new methods in Class class that assist us with getting information about the created nest. These methods include the following: getNestHost(), getNestMembers() and isNestemateOf().
  • 15. © 2008 Haim Michael 20151026 Epsilon  As of Java 11, the JVM has an experimental feature that allows us to run the JVM without any actual memory reclamation.  The goal is to provide a completely passive garbage collector implementation with a bounded allocation limit and the lowest latency overhead possible. https://openjdk.java.net/jeps/318
  • 16. © 2008 Haim Michael 20151026 Deprecated Modules Removal  As of Java 11, Java EE and CORBA modules that were already marked as deprecated in Java 9 are now completely removed. java.xml.ws java.xml.bind java.activation java.xml.ws.annotation java.corba java.transaction java.se.ee jdk.xml.ws jdk.xml.bind
  • 17. © 2008 Haim Michael 20151026 Flight Recorder  The Flight Recorder is a profiling tool with a negligible overhead below 1%. This extra ordinary overhead allows us to use it even in production.  The Flight Recorder, also known as JFR, used to be a commercial add-on in Oracle JDK. It was recently open sourced.
  • 18. © 2008 Haim Michael 20151026 Flight Recorder  Using the jps command we can get the process id of our Java program.
  • 19. © 2008 Haim Michael 20151026 Flight Recorder  Using the jcmd command we can perform various commands, such as jcmd 43659 JFR.start
  • 20. © 2008 Haim Michael 20151026 Flight Recorder  Using the jcmd command together with JFR.dump we can dump all data to a textual file we choose its name and it location on our computer.
  • 21. © 2008 Haim Michael 20151026 Flight Recorder  There are various possibilities to process the new created data file. https://github.com/lhotari/jfr-report-tool
  • 22. © 2008 Haim Michael 20151026 The HTTP Client  As of Java 11, the HTTP Client API is more standardized.  The new API supports both HTTP/1.1 and HTTP/2.  The new API also supports HTML5 WebSockets.
  • 23. © 2008 Haim Michael 20151026 The HTTP Client  As of Java 11, the HTTP Client API is more standardized. The new API supports both HTTP/1.1 and HTTP/2. The new API also supports HTML5 WebSockets.
  • 24. © 2008 Haim Michael 20151026 The HTTP Client package com.lifemichael.samples; import java.io.IOException; import java.net.http.*; import java.net.*; import java.net.http.HttpResponse.*; public class HTTPClientDemo { public static void main(String args[]) { HttpClient httpClient = HttpClient.newBuilder().build();
  • 25. © 2008 Haim Michael 20151026 The HTTP Client HttpRequest request = HttpRequest.newBuilder().uri(URI.create( "http://www.abelski.com/courses/dom/lib_doc.xml")) .GET() .build(); try { HttpResponse<String> response = httpClient.send( request, BodyHandlers.ofString()); System.out.println(response.body()); System.out.println(response.statusCode()); } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } } }
  • 26. © 2008 Haim Michael 20151026 The HTTP Client  The new HTTP Client allows us to initiate an asynchronous HTTP request. HttpClient .sendAsync(request,BodyHandlers.ofString()) .thenAccept(response -> { System.out.println(response.body()); //.. });
  • 27. © 2008 Haim Michael 20151026 The HTTP Client  The new HTTP Client supports the WebSocket protocol. HttpClient httpClient = HttpClient.newBuilder() .executor(executor).build(); Builder webSocketBuilder = httpClient.newWebSocketBuilder(); WebSocket webSocket = webSocketBuilder .buildAsync( URI.create("wss://echo.websocket.org"), … ).join();
  • 28. © 2008 Haim Michael 20151026 Nashorn is Deprecated  As of Java 11, the Nashorn JavaScript engine and APIs are deprecated. Most likely, in future versions of the JDK.
  • 29. © 2008 Haim Michael 20151026 The ZGC Scalable Low Latency GC  As of Java 11, we can use the ZGC. This new GC is available as an experimental feature.  ZGC is a scalable low latency garbage collector. It performs the expensive work concurrently without stopping the execution of application threads for more than 10ms.
  • 30. © 2008 Haim Michael 20151026 The ZGC Scalable Low Latency GC  ZGC is suitable especially for applications that require low latency and/or use a very large heap (multi- terabytes).
  • 31. © 2008 Haim Michael 20151026 Files Reading and Writing  Java 11 introduces two new methods that significantly assist with reading and writing strings from and to files. readString() writeString()
  • 32. © 2008 Haim Michael 20151026 Files Reading and Writing public class FilesReadingDemo { public static void main(String args[]) { try { Path path = FileSystems.getDefault() .getPath(".", "welove.txt"); String str = Files.readString(path); System.out.println(str); } catch (IOException e) { e.printStackTrace(); } }
  • 33. © 2008 Haim Michael 20151026 Files Reading and Writing public class FilesWritingDemo { public static void main(String args[]) { Path path = FileSystems.getDefault() .getPath(".", "welove.txt"); try { Files.writeString(path, "we love php", StandardOpenOption.APPEND); } catch (IOException e) { e.printStackTrace(); } } }
  • 34. © 2008 Haim Michael 20151026 Q&A Thanks for attending our meetup! I hope you enjoyed! I will be more than happy to get feedback. Haim Michael haim.michael@lifemichael.com 0546655837