售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Dedication
About Packt
Why subscribe?
Packt.com
Contributors
About the author
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Reviews
Section 1: Overview of Java Programming
Getting Started with Java 12
How to install and run Java
What is 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 type
Numeric types
Integral types
Floating-point types
Default values of primitive types
Literals of primitive types
New compact number format
Operators
Arithmetic unary (+ and -) and binary operators (+, -, *, /, and %)
Increment and decrement unary operators (++ and --)
Equality operators (== and !=)
Relational operators (<, >, <=, and >=)
Logical operators (!, &, and |)
Conditional operators (&&, ||, and ? :)
Assignment operators (=, +=, -=, *=, /=, and %=)
String types and literals
String literals
String immutability
Identifiers and variables
Identifier
Variable declaration (definition) and initialization
Type holder var
Java statements
Expression statements
Control flow statements
Selection statements
Iteration statements
Exception-handling statements
Branching statements
Summary
Quiz
Java Object-Oriented Programming (OOP)
OOP concepts
Object/class
Inheritance
Abstraction/interface
Encapsulation
Polymorphism
Class
Method
Varargs
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
Final variable, method, and classes
Final variable
Final method
Final class
Polymorphism in action
Object factory
Operator instanceof
Summary
Quiz
Java Fundamentals
Packages, importing, and access
Packages
Importing
Access modifiers
Java reference types
Class and interface
Array
Enum
Default values and literals
Reference type as a method parameter
equals() method
Reserved and restricted keywords
Reserved keywords
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
Section 2: Building Blocks of Java
Exception Handling
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 exceptions handling
Summary
Quiz
Strings, Input/Output, and Files
Strings processing
Methods of the String class
Strings analysis
Strings comparison
Strings transformation
Methods added with Java 11
String utilities
I/O streams
Stream data
Class InputStream and its subclasses
ByteArrayInputStream
FileInputStream
ObjectInputStream
PipedInputStream
SequenceInputStream
FilterInputStream
javax.sound.sampled.AudioInputStream
Class OutputStream and its subclasses
PrintStream
Reader and Writer classes and their subclasses
Reader and its subclasses
Writer and its subclasses
Other classes of java.io package
Console
StreamTokenizer
ObjectStreamClass and ObjectStreamField
Class java.util.Scanner
File management
Creating and deleting files and directories
Listing files and directories
Apache Commons utilities FileUtils and IOUtils
Class FileUtils
Class IOUtils
Summary
Quiz
Data Structures, Generics, and Popular Utilities
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
Object utilities
java.util.Objects class
ObjectUtils class
java.time package
LocalDate class
LocalTime class
LocalDateTime class
Period and Duration classes
Summary
Quiz
Java Standard and External Libraries
Java Class Library
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
lang and lang3
collections4
codec.binary
Summary
Quiz
Multithreading and Concurrent Processing
Thread versus process
User thread versus daemon
Extending class thread
Implementing interface Runnable
Extending thread vs implementing Runnable
Using pool of threads
Getting results from thread
Parallel vs concurrent processing
Concurrent modification of the same resource
Atomic variable
Synchronized method
Synchronized block
Concurrent collections
Addressing memory consistency error
Summary
Quiz
JVM Structure and Garbage Collection
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
Class loading
Class linking
Class initialization
Class instantiation
Method execution
Garbage collection
Application termination
JVM structure
Runtime data areas
Classloaders
Execution engine
Garbage collection
Responsiveness, throughput, and stop-the-world
Object age and generations
When stop-the-world is unavoidable
Summary
Quiz
Managing Data in a Database
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
The execute(String sql) method
The executeQuery(String sql) method
The executeUpdate(String sql) method
Using PreparedStatement
Using CallableStatement
Summary
Quiz
Network Programming
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
Java GUI Programming
Java GUI technologies
JavaFX fundamentals
Hello with JavaFX
Control elements
Charts
Applying CSS
Using FXML
Embedding HTML
Playing media
Adding effects
Summary
Quiz
Section 3: Advanced Java
Functional Programming
What is functional programming?
What is a functional interface?
What is a lambda expression?
Local-variable syntax for lambda parameters
Standard functional interfaces
Consumer<T>
Predicate<T>
Supplier<T>
Function<T, R>
Other standard functional interfaces
Lambda expression limitations
Method references
Summary
Quiz
Java Standard Streams
Streams as a source of data and operations
Stream initialization
Stream interface
empty()
of(T... values)
ofNullable(T t)
iterate(Object, UnaryOperator)
concat (Stream a, Stream b)
generate (Supplier)
Stream.Builder interface
Other classes and interfaces
Operations (methods)
Intermediate operations
Filtering
Mapping
Sorting
Peeking
Terminal operations
Processing each element
Counting all elements
Match all, any, none
Find any or first
Optional class
Min and max
To array
Reduce
Collect
Collectors
Numeric stream interfaces
Creating a stream
range(), rangeClosed()
Intermediate operations
boxed(), mapToObj()
mapToInt(), mapToLong(), mapToDouble()
flatMapToInt(), flatMapToLong(), flatMapToDouble()
Terminal operations
sum(), average()
Parallel streams
Stateless and stateful operations
Sequential or parallel processing?
Summary
Quiz
Reactive Programming
Asynchronous processing
Sequential and parallel streams
Using the CompletableFuture object
Non-blocking API
The java.io package versus the java.nio package
The event/run loop
Reactive
Responsive
Resilient
Elastic
Message-driven
Reactive streams
RxJava
Observable types
Blocking versus non-blocking
Cold versus hot
Disposable
Creating an observable
Operators
Transforming
Filtering
Combining
Converting from XXX
Exceptions handling
Life cycle events handling
Utilities
Conditional and Boolean
Backpressure
Connectable
Multithreading (scheduler)
Summary
Quiz
Microservices
What is a microservice?
The size of a microservice
How microservices talk to each other
The reactive system of microservices
The HTTP server
The EventBus message receiver
The EventBus message senders
The reactive system demonstration
Summary
Quiz
Java Microbenchmark Harness
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
Best Practices for Writing High-Quality Code
Java idioms, their implementation, and their usage
The equals() and hashCode() methods
The compareTo() method
The clone() method
The StringBuffer and StringBuilder classes
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
Testing is the shortest path to quality code
Summary
Quiz
Java - Getting New Features
Java continues to evolve
Panama project
Valhalla project
Amber project
Data class
Pattern match
Raw string literals
Concise method bodies
Lambda leftovers
Using an underscore instead of a parameter name
Shadowing a local variable
Better disambiguation of functional expressions
Loom project
Skara project
Summary
Assessments
Chapter 1 – Getting Started with Java 12
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 – Microservices
Chapter 17 – Java Microbenchmark Harness
Chapter 18 – Best Practices for Writing High-Quality Code
Other Books You May Enjoy
Leave a review - let other readers know what you think
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜