Book description
The professional programmer’s Deitel® guide to Java® 9 and the powerful Java platform
Written for programmers with a background in another high-level language, this book applies the Deitel signature live-code approach to teaching programming and explores the Java® 9 language and APIs in depth. The book presents concepts in fully tested programs, complete with code walkthroughs, syntax shading, code highlighting and program outputs. It features hundreds of complete Java 9 programs with thousands of lines of proven code, and hundreds of software-development tips that will help you build robust applications.
Start with an introduction to Java using an early classes and objects approach, then rapidly move on to more advanced topics, including JavaFX GUI, graphics, animation and video, exception handling, lambdas, streams, functional interfaces, object serialization, concurrency, generics, generic collections, database with JDBC™ and JPA, and compelling new Java 9 features, such as the Java Platform Module System, interactive Java with JShell (for discovery, experimentation and rapid prototyping) and more. You’ll enjoy the Deitels’ classic treatment of object-oriented programming and the object-oriented design ATM case study, including a complete Java implementation. When you’re finished, you’ll have everything you need to build industrial-strength, object-oriented Java 9 applications.
New Java® 9 Features
Java® 9’s Platform Module System
Interactive Java via JShell—Java 9’s REPL
Collection Factory Methods, Matcher Methods, Stream Methods, JavaFX Updates, Using Modules in JShell, Completable Future Updates, Security Enhancements, Private Interface Methods and many other language and API updates.
Core Java Features
Classes, Objects, Encapsulation, Inheritance, Polymorphism, Interfaces
Composition vs. Inheritance, “Programming to an Interface not an Implementation”
Lambdas, Sequential and Parallel Streams, Functional Interfaces with Default and Static Methods, Immutability
JavaFX GUI, 2D and 3D Graphics, Animation, Video, CSS, Scene Builder
Files, I/O Streams, XML Serialization
Concurrency for Optimal Multi-Core Performance, JavaFX Concurrency APIs
Generics and Generic Collections
Recursion, Database (JDBC™ and JPA)
Keep in Touch
Contact the authors at: deitel@deitel.com
Join the Deitel social media communities LinkedIn® at bit.ly/DeitelLinkedIn
Facebook® at facebook.com/DeitelFan
Twitter® at twitter.com/deitel
YouTube™ at youtube.com/DeitelTV
Subscribe to the Deitel ® Buzz e-mail newsletter at www.deitel.com/newsletter/subscribe.html
For source code and updates, visit: www.deitel.com/books/Java9FP
Table of contents
- Cover Page
- Title Page
- Copyright Page
- Detication Page
- Contents
- Foreword
- Preface
- Before You Begin
- 1. Introduction and Test-Driving a Java Application
- 2. Introduction to Java Applications; Input/Output and Operators
- 3. Introduction to Classes, Objects, Methods and Strings
-
4. Control Statements: Part 1; Assignment, ++ and -- Operators
- 4.1 Introduction
- 4.2 Control Structures
- 4.3 if Single-Selection Statement
- 4.4 if...else Double-Selection Statement
- 4.5 while Iteration Statement
- 4.6 Counter-Controlled Iteration
- 4.7 Sentinel-Controlled Iteration
- 4.8 Nesting Different Control Statements
- 4.9 Compound Assignment Operators
- 4.10 Increment and Decrement Operators
- 4.11 Primitive Types
- 4.12 Wrap-Up
-
5. Control Statements: Part 2; Logical Operators
- 5.1 Introduction
- 5.2 Essentials of Counter-Controlled Iteration
- 5.3 for Iteration Statement
- 5.4 Examples Using the for Statement
- 5.5 do...while Iteration Statement
- 5.6 switch Multiple-Selection Statement
- 5.7 Class AutoPolicy: Strings in switch Statements
- 5.8 break and continue Statements
- 5.9 Logical Operators
- 5.10 Wrap-Up
-
6. Methods: A Deeper Look
- 6.1 Introduction
- 6.2 Program Units in Java
- 6.3 static Methods, static Fields and Class Math
- 6.4 Methods with Multiple Parameters
- 6.5 Notes on Declaring and Using Methods
- 6.6 Argument Promotion and Casting
- 6.7 Java API Packages
- 6.8 Case Study: Secure Random-Number Generation
- 6.9 Case Study: A Game of Chance; Introducing enum Types
- 6.10 Scope of Declarations
- 6.11 Method Overloading
- 6.12 Wrap-Up
-
7. Arrays and ArrayLists
- 7.1 Introduction
- 7.2 Arrays
- 7.3 Declaring and Creating Arrays
- 7.4 Examples Using Arrays
- 7.5 Exception Handling: Processing the Incorrect Response
- 7.6 Case Study: Card Shuffling and Dealing Simulation
- 7.7 Enhanced for Statement
- 7.8 Passing Arrays to Methods
- 7.9 Pass-By-Value vs. Pass-By-Reference
- 7.10 Case Study: Class GradeBook Using an Array to Store Grades
- 7.11 Multidimensional Arrays
- 7.12 Case Study: Class GradeBook Using a Two-Dimensional Array
- 7.13 Variable-Length Argument Lists
- 7.14 Using Command-Line Arguments
- 7.15 Class Arrays
- 7.16 Introduction to Collections and Class ArrayList
- 7.17 Wrap-Up
-
8. Classes and Objects: A Deeper Look
- 8.1 Introduction
- 8.2 Time Class Case Study
- 8.3 Controlling Access to Members
- 8.4 Referring to the Current Object’s Members with the this Reference
- 8.5 Time Class Case Study: Overloaded Constructors
- 8.6 Default and No-Argument Constructors
- 8.7 Notes on Set and Get Methods
- 8.8 Composition
- 8.9 enum Types
- 8.10 Garbage Collection
- 8.11 static Class Members
- 8.12 static Import
- 8.13 final Instance Variables
- 8.14 Package Access
- 8.15 Using BigDecimal for Precise Monetary Calculations
- 8.16 JavaMoney API
- 8.17 Time Class Case Study: Creating Packages
- 8.18 Wrap-Up
- 9. Object-Oriented Programming: Inheritance
-
10. Object--Oriented Programming: Polymorphism and Interfaces
- 10.1 Introduction
- 10.2 Polymorphism Examples
- 10.3 Demonstrating Polymorphic Behavior
- 10.4 Abstract Classes and Methods
- 10.5 Case Study: Payroll System Using Polymorphism
- 10.6 Allowed Assignments Between Superclass and Subclass Variables
- 10.7 final Methods and Classes
- 10.8 A Deeper Explanation of Issues with Calling Methods from Constructors
- 10.9 Creating and Using Interfaces
- 10.10 Java SE 8 Interface Enhancements
- 10.11 Java SE 9 private Interface Methods
- 10.12 private Constructors
- 10.13 Program to an Interface, Not an Implementation
- 10.14 Wrap-Up
-
11. Exception Handling: A Deeper Look
- 11.1 Introduction
- 11.2 Example: Divide by Zero without Exception Handling
- 11.3 Example: Handling ArithmeticExceptions and InputMismatchExceptions
- 11.4 When to Use Exception Handling
- 11.5 Java Exception Hierarchy
- 11.6 finally Block
- 11.7 Stack Unwinding and Obtaining Information from an Exception
- 11.8 Chained Exceptions
- 11.9 Declaring New Exception Types
- 11.10 Preconditions and Postconditions
- 11.11 Assertions
- 11.12 try-with-Resources: Automatic Resource Deallocation
- 11.13 Wrap-Up
- 12. JavaFX Graphical User Interfaces: Part 1
-
13. JavaFX GUI: Part 2
- 13.1 Introduction
- 13.2 Laying Out Nodes in a Scene Graph
- 13.3 Painter App: RadioButtons, Mouse Events and Shapes
- 13.4 Color Chooser App: Property Bindings and Property Listeners
- 13.5 Cover Viewer App: Data-Driven GUIs with JavaFX Collections
- 13.6 Cover Viewer App: Customizing ListView Cells
- 13.7 Additional JavaFX Capabilities
- 13.8 JavaFX 9: Java SE 9 JavaFX Updates
- 13.9 Wrap-Up
- 14. Strings, Characters and Regular Expressions
- 15. Files, Input/Output Streams, NIO and XML Serialization
-
16. Generic Collections
- 16.1 Introduction
- 16.2 Collections Overview
- 16.3 Type-Wrapper Classes
- 16.4 Autoboxing and Auto-Unboxing
- 16.5 Interface Collection and Class Collections
- 16.6 Lists
- 16.7 Collections Methods
- 16.8 Class PriorityQueue and Interface Queue
- 16.9 Sets
- 16.10 Maps
- 16.11 Synchronized Collections
- 16.12 Unmodifiable Collections
- 16.13 Abstract Implementations
- 16.14 Java SE 9: Convenience Factory Methods for Immutable Collections
- 16.15 Wrap-Up
-
17. Lambdas and Streams
- 17.1 Introduction
- 17.2 Streams and Reduction
- 17.3 Mapping and Lambdas
- 17.4 Filtering
- 17.5 How Elements Move Through Stream Pipelines
- 17.6 Method References
- 17.7 IntStream Operations
- 17.8 Functional Interfaces
- 17.9 Lambdas: A Deeper Look
- 17.10 Stream<Integer> Manipulations
- 17.11 Stream<String> Manipulations
- 17.12 Stream<Employee> Manipulations
- 17.13 Creating a Stream<String> from a File
- 17.14 Streams of Random Values
- 17.15 Infinite Streams
- 17.16 Lambda Event Handlers
- 17.17 Additional Notes on Java SE 8 Interfaces
- 17.18 Wrap-Up
-
18. Recursion
- Outline
- 18.1 Introduction
- 18.2 Recursion Concepts
- 18.3 Example Using Recursion: Factorials
- 18.4 Reimplementing Class FactorialCalculator Using BigInteger
- 18.5 Example Using Recursion: Fibonacci Series
- 18.6 Recursion and the Method-Call Stack
- 18.7 Recursion vs. Iteration
- 18.8 Towers of Hanoi
- 18.9 Fractals
- 18.10 Recursive Backtracking
- 18.11 Wrap-Up
-
19. Generic Classes and Methods: A Deeper Look
- 19.1 Introduction
- 19.2 Motivation for Generic Methods
- 19.3 Generic Methods: Implementation and Compile-Time Translation
- 19.4 Additional Compile-Time Translation Issues: Methods That Use a Type Parameter as the Return Type
- 19.5 Overloading Generic Methods
- 19.6 Generic Classes
- 19.7 Wildcards in Methods That Accept Type Parameters
- 19.8 Wrap-Up
-
20. JavaFX Graphics, Animation and Video
- 20.1 Introduction
- 20.2 Controlling Fonts with Cascading Style Sheets (CSS)
- 20.3 Displaying Two-Dimensional Shapes
- 20.4 Polylines, Polygons and Paths
- 20.5 Transforms
- 20.6 Playing Video with Media, MediaPlayer and MediaViewer
- 20.7 Transition Animations
- 20.8 Timeline Animations
- 20.9 Frame-by-Frame Animation with AnimationTimer
- 20.10 Drawing on a Canvas
- 20.11 Three-Dimensional Shapes
- 20.12 Wrap-Up
-
21. Concurrency and Multi-Core Performance
- 21.1 Introduction
- 21.2 Thread States and Life Cycle
- 21.3 Creating and Executing Threads with the Executor Framework
- 21.4 Thread Synchronization
- 21.5 Producer/Consumer Relationship without Synchronization
- 21.6 Producer/Consumer Relationship: ArrayBlockingQueue
- 21.7 (Advanced) Producer/Consumer Relationship with synchronized, wait, notify and notifyAll
- 21.8 (Advanced) Producer/Consumer Relationship: Bounded Buffers
- 21.9 (Advanced) Producer/Consumer Relationship: The Lock and Condition Interfaces
- 21.10 Concurrent Collections
- 21.11 Multithreading in JavaFX
- 21.12 sort/parallelSort Timings with the Java SE 8 Date/Time API
- 21.13 Java SE 8: Sequential vs. Parallel Streams
- 21.14 (Advanced) Interfaces Callable and Future
- 21.15 (Advanced) Fork/Join Framework
- 21.16 Wrap-Up
- 22. Accessing Databases with JDBC
-
23. Introduction to JShell: Java 9’s REPL for Interactive Java
- 23.1 Introduction
- 23.2 Installing JDK 9
- 23.3 Introduction to JShell
- 23.4 Command-Line Input in JShell
- 23.5 Declaring and Using Classes
- 23.6 Discovery with JShell Auto-Completion
- 23.7 Exploring a Class’s Members and Viewing Documentation
- 23.8 Declaring Methods
- 23.9 Exceptions
- 23.10 Importing Classes and Adding Packages to the CLASSPATH
- 23.11 Using an External Editor
- 23.12 Summary of JShell Commands
- 23.13 Keyboard Shortcuts for Snippet Editing
- 23.14 How JShell Reinterprets Java for Interactive Use
- 23.15 IDE JShell Support
- 23.16 Wrap-Up
- 24. Java Persistence API (JPA)
- 25. ATM Case Study, Part 1: Object-Oriented Design with the UML
- 26. ATM Case Study Part 2: Implementing an Object-Oriented Design
-
27. Java Platform Module System
- 27.1 Introduction
- 27.2 Module Declarations
- 27.3 Modularized Welcome App
- 27.4 Creating and Using a Custom Module
- 27.5 Module-Dependency Graphs: A Deeper Look
- 27.6 Migrating Code to Java 9
- 27.7 Resources in Modules; Using an Automatic Module
- 27.8 Creating Custom Runtimes with jlink
- 27.9 Services and ServiceLoader
- 27.10 Wrap-Up
-
28. Additional Java 9 Topics
- 28.1 Introduction
- 28.2 Recap: Java 9 Features Covered in Earlier Chapters
- 28.3 New Version String Format
- 28.4 Regular Expressions: New Matcher Class Methods
- 28.5 New Stream Interface Methods
- 28.6 Modules in JShell
- 28.7 JavaFX 9 Skin APIs
- 28.8 Other GUI and Graphics Enhancements
- 28.9 Security Related Java 9 Topics
- 28.10 Other Java 9 Topics
- 28.11 Items Removed from the JDK and Java 9
- 28.12 Items Proposed for Removal from Future Java Versions
- 28.13 Wrap-Up
- A. Operator Precedence Chart
- B. ASCII Character Set
- C. Keywords and Reserved Words
- D. Primitive Types
- E. Bit Manipulation
- F. Labeled break and continue Statements
- Index
- Code Snippets
Product information
- Title: Java 9 for Programmers
- Author(s):
- Release date: May 2017
- Publisher(s): Pearson
- ISBN: 9780134778167
You might also like
book
Java 9 Modularity
The upcoming Java 9 module system will affect existing applications and offer new ways of creating …
video
Java Programming Essentials
8+ Hours of Video Instruction Overview Build a solid understanding of core features of the Java …
book
Java 8 in Action
Java 8 in Action is a clearly written guide to the new features of Java 8. …
book
Think Java, 2nd Edition
Currently used at many colleges, universities, and high schools, this hands-on introduction to computer science is …