Learn Java 17 Programming: Learn the fundamentals of Java Programming with this updated guide with the latest features

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Explore the essential concepts of programming such as object-oriented, functional, and reactive programming by writing code and building projects using the latest LTS version of Java

Key Features

  • A step-by-step guide for beginners to get started with programming in Java 17
  • Explore core programming topics including GUI programming, concurrency, and error handling
  • Write efficient code and build projects while learning the fundamentals of programming

Book Description

Java is one of the most preferred languages among developers. It is used in everything right from smartphones and game consoles to even supercomputers, and its new features simply add to the richness of the language.

This book on Java programming begins by helping you learn how to install the Java Development Kit. You'll then focus on understanding object-oriented programming (OOP), with exclusive insights into concepts such as abstraction, encapsulation, inheritance, and polymorphism, which will help you when programming for real-world apps. Next, you'll cover fundamental programming structures of Java such as data structures and algorithms that will serve as the building blocks for your apps with the help of sample programs and practice examples. You'll also delve into core programming topics that will assist you with error handling, debugging, and testing your apps. As you progress, you'll move on to advanced topics such as Java libraries, database management, and network programming and also build a sample project to help you understand the applications of these concepts.

By the end of this Java book, you'll not only have become well-versed with Java 17 but also gained a perspective into the future of this language and have the skills to code efficiently with best practices.

What you will learn

  • Understand and apply object-oriented principles in Java
  • Explore Java design patterns and best practices to solve everyday problems
  • Build user-friendly and attractive GUIs with ease
  • Understand the usage of microservices with the help of practical examples
  • Discover techniques and idioms for writing high-quality Java code
  • Get to grips with the usage of data structures in Java

Who this book is for

This book is for those who would like to start a new career in the modern Java programming profession, as well as those who do it professionally already and would like to refresh their knowledge of the latest Java and related technologies and ideas.

Table of Contents

  1. Getting started with Java 17
  2. Java Object-Oriented Programming (OOP)
  3. Java fundamentals
  4. Exception handling
  5. Strings, input/output, and files
  6. Data structures, generics and popular utilities
  7. Java standard and external libraries
  8. Multithreading and concurrent processing
  9. JVM structure and garbage collection
  10. Managing Data in a Database
  11. Network Programming
  12. Java GUI programming
  13. Functional programming
  14. Java standard streams
  15. Reactive programming
  16. Java Microbenchmark Harness
  17. Best practices for writing high-quality code

Author(s): Nick Samoylov
Edition: 2
Publisher: Packt Publishing
Year: 2022

Language: English
Commentary: Vector PDF. This PDF doesn't have watermarks showing uploader's website. Book @ FFC5D8C6F870333CBD45BEC3841B2A1C has watermarks.
Pages: 748
City: Birmingham, UK
Tags: Java; Java 17; Object-Oriented Programming; OOP; Programming Best Practices; Multithreading; Concurrent Processing; JVM; Garbage Collection; Network Programming; Java GUI Programming; Functional Programming; Reactive Programming

Cover
Title Page
Copyright and Credits
Contributors
Table of Contents
Preface
Part 1: Overview of Java Programming
Chapter 1: Getting Started with Java 17
Technical requirements
How to install and run Java
What is the JDK and why do we need it?
Installing Java SE
Commands, tools, and utilities
How to install and run an IDE
Selecting an IDE
Installing and configuring IntelliJ IDEA
Creating a project
Importing a project
Executing examples from the command line
Java primitive types and operators
Boolean types
Numeric types
Default values of primitive types
Literals of primitive types
New compact number format
Operators
String types and literals
String literals
String immutability
IDs and variables
ID
Variable declaration (definition) and initialization
Java statements
Expression statements
Control flow statements
Summary
Quiz
Chapter 2: Java Object-Oriented Programming (OOP)
Technical requirements
OOP concepts
Object/class
Inheritance
Abstraction/interface
Encapsulation
Polymorphism
Class
Method
Constructor
The new operator
Class java.lang.Object
Instance and static properties and methods
Interface
Default methods
Private methods
Static fields and methods
Interface versus abstract class
Overloading, overriding, and hiding
Overloading
Overriding
Hiding
The final variable, method, and classes
The final variable
Final method
Final class
The record class
Sealed classes and interfaces
Polymorphism in action
The object factory
The instanceof operator
Summary
Quiz
Chapter 3: Java Fundamentals
Technical requirements
Packages, importing, and access
Packages
Importing
Access modifiers
Java reference types
Class and interface
Array
Enum
Default values and literals
A reference type as a method parameter
equals() method
Reserved and restricted keywords
Reserved keywords
Reserved identifiers
Reserved words for literal values
Restricted keywords
Usage of the this and super keywords
Usage of the this keyword
Usage of the super keyword
Converting between primitive types
Widening conversion
Narrowing conversion
Methods of conversion
Converting between primitive and reference types
Boxing
Unboxing
Summary
Quiz
Part 2: Building Blocks of Java
Chapter 4: Exception Handling
Technical requirements
The Java exceptions framework
Checked and unchecked exceptions
The try, catch, and finally blocks
The throws statement
The throw statement
The assert statement
Best practices of exception handling
Summary
Quiz
Chapter 5: Strings, Input/Output,and Files
Technical requirements
String processing
Methods of the String class
String utilities
I/O streams
Stream data
The InputStream class and its subclasses
The OutputStream class and its subclasses
The Reader and Writer classes and their subclasses
Other classes of the java.io package
The java.util.Scanner class
File management
Creating and deleting files and directories
Listing files and directories
Apache Commons’ FileUtils and IOUtils utilities
The FileUtils class
The IOUtils class
Summary
Quiz
Chapter 6: Data Structures, Generics, and Popular Utilities
Technical requirements
List, Set, and Map interfaces
Generics
How to initialize List and Set
java.lang.Iterable interface
Collection interface
List interface
Set interface
Map interface
Unmodifiable collections
Collections utilities
java.util.Collections class
CollectionUtils class
Arrays utilities
java.util.Arrays class
ArrayUtils class
Objects utilities
java.util.Objects class
ObjectUtils class
The java.time package
LocalDate class
LocalTime class
LocalDateTime class
Period and Duration classes
Period of day
Summary
Quiz
Chapter 7: Java Standard and External Libraries
Technical requirements
Java Class Library (JCL)
java.lang
java.util
java.time
java.io and java.nio
java.sql and javax.sql
java.net
java.lang.math and java.math
java.awt, javax.swing, and javafx
External libraries
org.junit
org.mockito
org.apache.log4j and org.slf4j
org.apache.commons
Summary
Quiz
Chapter 8: Multithreading and Concurrent Processing
Technical requirements
Thread versus process
User thread versus daemon
Extending the Thread class
Implementing the Runnable interface
Extending Thread versus implementing Runnable
Using a pool of threads
Getting results from a thread
Parallel versus concurrent processing
Concurrent modification of the same resource
Atomic variable
Synchronized method
Synchronized block
Concurrent collections 
Addressing memory consistency errors
Summary
Quiz
Chapter 9: JVM Structure and Garbage Collection
Technical requirements
Java application execution
Using an IDE
Using the command line with classes
Using the command line with JAR files
Using the command line with an executable JAR file
Java processes 
Classloading
Class linking
Class initialization
Class instantiation
Method execution
Garbage collection
Application termination
JVM’s structure
Runtime data areas
Classloaders
Execution engine
Garbage collection
Responsiveness, throughput, and stop-the-world
Object age and generation
When stop-the-world is unavoidable
Summary
Quiz
Chapter 10: Managing Data in a Database
Technical requirements
Creating a database
Creating a database structure
Connecting to a database
Releasing the connection
CRUD data
The INSERT statement
The SELECT statement
The UPDATE statement
The DELETE statement
Using statements
Using PreparedStatement
Using CallableStatement
Using a shared library JAR file to access a database
Summary
Quiz
Chapter 11: Network Programming
Technical requirements
Network protocols
UDP-based communication
TCP-based communication
The java.net.ServerSocket class
The java.net.Socket class
Running the examples
UDP versus TCP protocols
URL-based communication
The URL syntax
The java.net.URL class
Using the HTTP 2 Client API
Blocking HTTP requests
Non-blocking (asynchronous) HTTP requests
Server push functionality
WebSocket support
Summary
Quiz
Chapter 12: Java GUI Programming
Technical requirements
Java GUI technologies
JavaFX fundamentals
HelloWorld with JavaFX
Control elements
Charts
Applying CSS
Using FXML
Embedding HTML
Playing media
Adding effects
Summary
Quiz
Part 3: Advanced Java
Chapter 13: Functional Programming
Technical requirements
What is functional programming?
What is a functional interface?
What is a Lambda expression?
Standard functional interfaces
Consumer
Predicate
Supplier
Function
Other standard functional interfaces
Lambda expression limitations
Method references
Summary
Quiz
Chapter 14: Java Standard Streams
Technical requirements
Streams as a source of data and operations
Stream initialization
Stream interface
The Stream.Builder interface
Other classes and interfaces
Operations (methods)
Intermediate operations
Terminal operations
Numeric stream interfaces
Creating a stream
Intermediate operations
Terminal operations
Parallel streams
Stateless and stateful operations
Sequential or parallel processing?
Summary
Quiz
Chapter 15: Reactive Programming
Technical requirements
Asynchronous processing
Sequential and parallel streams
Using the CompletableFuture object
Non-blocking APIs
The java.io package versus the java.nio package
The event/run loop
Reactive
Responsive
Resilient
Elastic
Message-driven
Reactive streams
RxJava
Observable types
Disposable
Creating an observable
Operators
Multithreading (scheduler)
Summary
Quiz
Chapter 16: Java Microbenchmark Harness
Technical requirements
What is JMH?
Creating a JMH benchmark
Running the benchmark
Using an IDE plugin
JMH benchmark parameters
Mode
Output time unit
Iterations
Forking
JMH usage examples
Using the @State annotation
Using the Blackhole object
Using the @CompilerControl annotation
Using the @Param annotation
A word of caution
Summary
Quiz
Chapter 17: Best Practices for Writing High-Quality Code
Technical requirements
Java idioms, their implementation, and their usage
The equals() and hashCode() methods
The compareTo() method
The clone() method
The StringBuffer and StringBuilder classes
The try, catch, and finally clauses
Best design practices
Identifying loosely coupled functional areas
Breaking the functional area into traditional tiers
Coding to an interface
Using factories
Preferring composition over inheritance
Using libraries
Code is written for people
Use well-established frameworks and libraries
Testing is the shortest path to quality code
Summary
Quiz
Assessments
Chapter 1 – Getting Started with Java 17
Chapter 2 – Java Object-Oriented Programming (OOP)
Chapter 3 – Java Fundamentals
Chapter 4 – Exception Handling
Chapter 5 – Strings, Input/Output, and Files
Chapter 6 – Data Structures, Generics, and Popular Utilities
Chapter 7 – Java Standard and External Libraries
Chapter 8 – Multithreading and Concurrent Processing
Chapter 9 – JVM Structure and Garbage Collection
Chapter 10 – Managing Data in a Database
Chapter 11 – Network Programming
Chapter 12 – Java GUI Programming
Chapter 13 – Functional Programming
Chapter 14 – Java Standard Streams
Chapter 15 – Reactive Programming
Chapter 16 – Java Microbenchmark Harness
Chapter 17 – Best Practices for Writing High-Quality Code
Index
Other Books You May Enjoy