Solution Manual for Java How to Program, Early Objects (11th Edition) (Deitel: How to Program) 11th Edition

Original price was: $35.00.Current price is: $26.50.

Solution Manual for Java How to Program, Early Objects (11th Edition) (Deitel: How to Program) 11th Edition Digital Instant Download

Category:

This is completed downloadable of Solution Manual for Java How to Program, Early Objects (11th Edition) (Deitel: How to Program) 11th Edition

Product Details:

  • ISBN-10 ‏ : ‎ 9780134743356
  • ISBN-13 ‏ : ‎ 978-0134743356
  • Author:   Paul Deitel (Author), Harvey Deitel (Author)

Unparalleled breadth and depth of object-oriented programming concepts

The Deitels’ groundbreaking How to Program series offers unparalleled breadth and depth of programming fundamentals, object-oriented programming concepts and intermediate-level topics for further study. Java How to Program, Early Objects, 11th Edition, presents leading-edge computing technologies using the Deitel signature live-code approach, which demonstrates concepts in hundreds of complete working programs. The 11th Edition presents updated coverage of Java SE 8 and new Java SE 9 capabilities, including JShell, the Java Module System, and other key Java 9 topics. [Java How to Program, Late Objects, 11th Edition also is available.]

 

Table of Content:

  1. Contents
  2. Foreword
  3. Preface
  4. New and Updated Features
  5. Flexibility Using Java SE 8 or the New Java SE 9
  6. Java How to Program, 11/e’s Modular Organization1
  7. Introduction and Programming Fundamentals (Parts 1 and 2)
  8. Flexible Coverage of Java 9: JShell, the Module System and Other Java 9 Topics (JShell Begins in Part 1; the Rest is in Part 9)
  9. Object-Oriented Programming (Part 3)
  10. Flexible JavaFX GUI, Graphics and Multimedia Coverage (Part 4) and Optional Swing Coverage (Part 11)
  11. Data Structures and Generic Collections (Part 5)
  12. Flexible Lambdas and Streams Coverage (Chapter 17)
  13. Database: JDBC and JPA (Part 7)
  14. Web Application Development and Web Services (Part 8)
  15. Optional Online Object-Oriented Design Case Study (Part 10)
  16. Teaching Approach
  17. Programming Wisdom
  18. What are JEPs, JSRs and the JCP?
  19. Secure Java Programming
  20. Companion Website: Source Code, VideoNotes, Online Chapters and Online Appendices
  21. Software Used in Java How to Program, 11/e
  22. Java Documentation Links
  23. Java How to Program, Late Objects Version, 11/e
  24. Instructor Supplements
  25. Online Practice and Assessment with MyProgrammingLab™
  26. Keeping in Touch with the Authors
  27. Reviewers
  28. A Special Thank You to Robert Field
  29. A Special Thank You to Brian Goetz
  30. About the Authors
  31. About Deitel® & Associates, Inc.
  32. About the Cover Art
  33. Before You Begin
  34. 1 Introduction to Computers, the Internet and Java
  35. Objectives
  36. Outline
  37. 1.1 Introduction
  38. 1.2 Hardware and Software
  39. 1.2.1 Moore’s Law
  40. 1.2.2 Computer Organization
  41. 1.3 Data Hierarchy
  42. 1.4 Machine Languages, Assembly Languages and High-Level Languages
  43. 1.5 Introduction to Object Technology
  44. 1.5.1 Automobile as an Object
  45. 1.5.2 Methods and Classes
  46. 1.5.3 Instantiation
  47. 1.5.4 Reuse
  48. 1.5.5 Messages and Method Calls
  49. 1.5.6 Attributes and Instance Variables
  50. 1.5.7 Encapsulation and Information Hiding
  51. 1.5.8 Inheritance
  52. 1.5.9 Interfaces
  53. 1.5.10 Object-Oriented Analysis and Design (OOAD)
  54. 1.5.11 The UML (Unified Modeling Language)
  55. 1.6 Operating Systems
  56. 1.6.1 Windows—A Proprietary Operating System
  57. 1.6.2 Linux—An Open-Source Operating System
  58. 1.6.3 Apple’s macOS and Apple’s iOS for iPhone®, iPad® and iPod Touch® Devices
  59. 1.6.4 Google’s Android
  60. 1.7 Programming Languages
  61. 1.8 Java
  62. 1.9 A Typical Java Development Environment
  63. 1.10 Test-Driving a Java Application
  64. 1.11 Internet and World Wide Web
  65. 1.11.1 Internet: A Network of Networks
  66. 1.11.2 World Wide Web: Making the Internet User-Friendly
  67. 1.11.3 Web Services and Mashups
  68. 1.11.4 Internet of Things
  69. 1.12 Software Technologies
  70. 1.13 Getting Your Questions Answered
  71. Self-Review Exercises
  72. Answers to Self-Review Exercises
  73. Exercises
  74. Making a Difference
  75. 2 Introduction to Java Applications; Input/Output and Operators
  76. Objectives
  77. Outline
  78. 2.1 Introduction
  79. 2.2 Your First Program in Java: Printing a Line of Text
  80. 2.2.1 Compiling the Application
  81. 2.2.2 Executing the Application
  82. 2.3 Modifying Your First Java Program
  83. 2.4 Displaying Text with printf
  84. 2.5 Another Application: Adding Integers
  85. 2.5.1 import Declarations
  86. 2.5.2 Declaring and Creating a Scanner to Obtain User Input from the Keyboard
  87. 2.5.3 Prompting the User for Input
  88. 2.5.4 Declaring a Variable to Store an Integer and Obtaining an Integer from the Keyboard
  89. 2.5.5 Obtaining a Second Integer
  90. 2.5.6 Using Variables in a Calculation
  91. 2.5.7 Displaying the Calculation Result
  92. 2.5.8 Java API Documentation
  93. 2.5.9 Declaring and Initializing Variables in Separate Statements
  94. 2.6 Memory Concepts
  95. 2.7 Arithmetic
  96. 2.8 Decision Making: Equality and Relational Operators
  97. 2.9 Wrap-Up
  98. Summary
  99. Section 2.2 Your First Program in Java: Printing a Line of Text
  100. Section 2.2.1 Compiling the Application
  101. Section 2.2.2 Executing the Application
  102. Section 2.3 Modifying Your First Java Program
  103. Section 2.4 Displaying Text with printf
  104. Section 2.5.1 import Declarations
  105. Section 2.5.2 Declaring and Creating a Scanner to Obtain User Input from the Keyboard
  106. Section 2.5.3 Prompting the User for Input
  107. Section 2.5.4 Declaring a Variable to Store an Integer and Obtaining an Integer from the Keyboard
  108. Section 2.5.6 Using Variables in a Calculation
  109. Section 2.5.7 Displaying the Calculation Result
  110. Section 2.5.9 Declaring and Initializing Variables in Separate Statements
  111. Section 2.6 Memory Concepts
  112. Section 2.7 Arithmetic
  113. Section 2.8 Decision Making: Equality and Relational Operators
  114. Self-Review Exercises
  115. Answers to Self-Review Exercises
  116. Exercises
  117. Making a Difference
  118. 3 Introduction to Classes, Objects, Methods and Strings
  119. Objectives
  120. Outline
  121. 3.1 Introduction1
  122. 3.2 Instance Variables, set Methods and get Methods
  123. 3.2.1 Account Class with an Instance Variable, and set and get Methods
  124. Class Declaration
  125. Identifiers and Camel-Case Naming
  126. Instance Variable name
  127. Access Modifiers public and private
  128. setName Method of Class Account
  129. Parameters Are Local Variables
  130. setName Method Body
  131. getName Method of Class Account
  132. 3.2.2 AccountTest Class That Creates and Uses an Object of Class Account
  133. Driver Class AccountTest
  134. Scanner Object for Receiving Input from the User
  135. Instantiating an Object—Keyword new and Constructors
  136. Calling Class Account’s getName Method
  137. null—the Default Initial Value for String Variables
  138. Calling Class Account’s setName Method
  139. Displaying the Name That Was Entered by the User
  140. 3.2.3 Compiling and Executing an App with Multiple Classes
  141. 3.2.4 Account UML Class Diagram
  142. Top Compartment
  143. Middle Compartment
  144. Bottom Compartment
  145. Return Types
  146. Parameters
  147. 3.2.5 Additional Notes on Class AccountTest
  148. static Method main
  149. Notes on import Declarations
  150. 3.2.6 Software Engineering with private Instance Variables and public set and get Methods
  151. Conceptual View of an Account Object with Encapsulated Data
  152. 3.3 Account Class: Initializing Objects with Constructors
  153. 3.3.1 Declaring an Account Constructor for Custom Object Initialization
  154. Account Constructor Declaration
  155. Parameter name of Class Account’s Constructor and Method setName
  156. 3.3.2 Class AccountTest: Initializing Account Objects When They’re Created
  157. Constructors Cannot Return Values
  158. Default Constructor
  159. There’s No Default Constructor in a Class That Declares a Constructor
  160. Adding the Constructor to Class Account’s UML Class Diagram
  161. 3.4 Account Class with a Balance; Floating-Point Numbers
  162. 3.4.1 Account Class with a balance Instance Variable of Type double
  163. Account Class Two-Parameter Constructor
  164. Account Class deposit Method
  165. Account Class getBalance Method
  166. Account’s Methods Can All Use balance
  167. 3.4.2 AccountTest Class to Use Class Account
  168. Displaying the Account Objects’ Initial Balances
  169. Formatting Floating-Point Numbers for Display
  170. Reading a Floating-Point Value from the User and Making a Deposit
  171. Duplicated Code in Method main
  172. UML Class Diagram for Class Account
  173. 3.5 Primitive Types vs. Reference Types
  174. 3.6 (Optional) GUI and Graphics Case Study: A Simple GUI
  175. 3.6.1 What Is a Graphical User Interface?
  176. 3.6.2 JavaFX Scene Builder and FXML
  177. FXML (FX Markup Language)
  178. 3.6.3 Welcome App—Displaying Text and an Image
  179. 3.6.4 Opening Scene Builder and Creating the File Welcome.fxml
  180. 3.6.5 Adding an Image to the Folder Containing Welcome.fxml
  181. 3.6.6 Creating a VBox Layout Container
  182. 3.6.7 Configuring the VBox
  183. Specifying the VBox’s Alignment
  184. Specifying the VBox’s Preferred Size
  185. 3.6.8 Adding and Configuring a Label
  186. Adding a Label to the VBox
  187. Changing the Label’s Text
  188. Changing the Label’s Font
  189. 3.6.9 Adding and Configuring an ImageView
  190. Adding an ImageView to the VBox
  191. Setting the ImageView’s Image
  192. Changing the ImageView’s Size
  193. 3.6.10 Previewing the Welcome GUI
  194. GUI and Graphics Case Study Exercise
  195. 3.7 Wrap-Up
  196. Summary
  197. Section 3.2 Instance Variables, set Methods and get Methods
  198. Section 3.2.1 Account Class with an Instance Variable, a set Method and a get Method
  199. Section 3.2.2 AccountTest Class That Creates and Uses an Object of Class Account
  200. Section 3.2.3 Compiling and Executing an App with Multiple Classes
  201. Section 3.2.4 Account UML Class Diagram with an Instance Variable and set and get Methods
  202. Section 3.2.5 Additional Notes on Class AccountTest
  203. Section 3.2.6 Software Engineering with private Instance Variables and public set and get Methods
  204. Section 3.3 Account Class: Initializing Objects with Constructors
  205. Section 3.4 Account Class with a Balance; Floating-Point Numbers
  206. Section 3.5 Primitive Types vs. Reference Types
  207. Self-Review Exercises
  208. Answers to Self-Review Exercises
  209. Exercises
  210. Making a Difference
  211. 4 Control Statements: Part 1; Assignment, ++ and — Operators
  212. Objectives
  213. Outline
  214. 4.1 Introduction
  215. 4.2 Algorithms
  216. 4.3 Pseudocode
  217. 4.4 Control Structures
  218. 4.4.1 Sequence Structure in Java
  219. 4.4.2 Selection Statements in Java
  220. 4.4.3 Iteration Statements in Java
  221. 4.4.4 Summary of Control Statements in Java
  222. 4.5 if Single-Selection Statement
  223. 4.6 if…else Double-Selection Statement
  224. UML Activity Diagram for an if…else Statement
  225. 4.6.1 Nested if…else Statements
  226. 4.6.2 Dangling-else Problem
  227. 4.6.3 Blocks
  228. 4.6.4 Conditional Operator (?:)
  229. 4.7 Student Class: Nested if…else Statements
  230. 4.8 while Iteration Statement
  231. 4.9 Formulating Algorithms: Counter-Controlled Iteration
  232. 4.10 Formulating Algorithms: Sentinel-Controlled Iteration
  233. 4.11 Formulating Algorithms: Nested Control Statements
  234. 4.12 Compound Assignment Operators
  235. 4.13 Increment and Decrement Operators
  236. 4.14 Primitive Types
  237. 4.15 (Optional) GUI and Graphics Case Study: Event Handling; Drawing Lines
  238. 4.15.1 Test-Driving the Completed Draw Lines App
  239. 4.15.2 Building the App’s GUI
  240. Opening Scene Builder and Creating the File DrawLines.fxml
  241. Creating a BorderPane Layout Container
  242. Adding a ToolBar and Configuring Its Button
  243. Configuring the Button’s Text
  244. Adding and Configuring a Canvas
  245. Setting the Canvas’s Width and Height
  246. Configuring the BorderPane Layout Container’s Size
  247. Saving the Design
  248. 4.15.3 Preparing to Interact with the GUI Programmatically
  249. Specifying the App’s Controller Class
  250. Specifying the Canvas’s Instance Variable Name
  251. Specifying the Button’s Event-Handler Method
  252. Generating the Initial Controller Class
  253. 4.15.4 Class DrawLinesController
  254. @FXML Annotation
  255. Getting a GraphicsContext to Draw on a Canvas
  256. Canvas’s Coordinate System
  257. Drawing Lines
  258. 4.15.5 Class DrawLines—The Main Application Class
  259. GUI and Graphics Case Study Exercises
  260. 4.16 Wrap-Up
  261. Summary
  262. Section 4.1 Introduction
  263. Section 4.2 Algorithms
  264. Section 4.3 Pseudocode
  265. Section 4.4 Control Structures
  266. Section 4.4.1 Sequence Structure in Java
  267. Section 4.4.2 Selection Statements in Java
  268. Section 4.4.3 Iteration Statements in Java
  269. Section 4.4.4 Summary of Control Statements in Java
  270. Section 4.5 if Single-Selection Statement
  271. Section 4.6 if…else Double-Selection Statement
  272. Section 4.6.1 Nested if…else Statements
  273. Section 4.6.2 Dangling-else Problem
  274. Section 4.6.3 Blocks
  275. Section 4.6.4 Conditional Operator (?:)
  276. Section 4.8 while Iteration Statement
  277. Section 4.9 Formulating Algorithms: Counter-Controlled Iteration
  278. Section 4.10 Formulating Algorithms: Sentinel-Controlled Iteration
  279. Section 4.12 Compound Assignment Operators
  280. Section 4.13 Increment and Decrement Operators
  281. Section 4.14 Primitive Types
  282. Self-Review Exercises
  283. Answers to Self-Review Exercises
  284. Exercises
  285. Making a Difference
  286. 5 Control Statements: Part 2; Logical Operators
  287. Objectives
  288. Outline
  289. 5.1 Introduction
  290. 5.2 Essentials of Counter-Controlled Iteration
  291. 5.3 for Iteration Statement
  292. 5.4 Examples Using the for Statement
  293. 5.4.1 Application: Summing the Even Integers from 2 to 20
  294. 5.4.2 Application: Compound-Interest Calculations
  295. Formatting Strings with Field Widths and Justification
  296. Performing the Interest Calculations with static Method pow of Class Math
  297. Formatting Floating-Point Numbers
  298. A Warning about Displaying Rounded Values
  299. 5.5 do…while Iteration Statement
  300. 5.6 switch Multiple-Selection Statement
  301. 5.7 Class AutoPolicy Case Study: Strings in switch Statements
  302. 5.8 break and continue Statements
  303. 5.8.1 break Statement
  304. 5.8.2 continue Statement
  305. 5.9 Logical Operators
  306. 5.9.1 Conditional AND (&&) Operator
  307. 5.9.2 Conditional OR (||) Operator
  308. 5.9.3 Short-Circuit Evaluation of Complex Conditions
  309. 5.9.4 Boolean Logical AND (&) and Boolean Logical Inclusive OR (|) Operators
  310. 5.9.5 Boolean Logical Exclusive OR (^)
  311. 5.9.6 Logical Negation (!) Operator
  312. 5.9.7 Logical Operators Example
  313. Precedence and Associativity of the Operators Presented So Far
  314. 5.10 Structured-Programming Summary
  315. 5.11 (Optional) GUI and Graphics Case Study: Drawing Rectangles and Ovals
  316. 5.12 Wrap-Up
  317. Summary
  318. Section 5.2 Essentials of Counter-Controlled Iteration
  319. Section 5.3 for Iteration Statement
  320. Section 5.4.2 Application: Compound-Interest Calculations
  321. Section 5.5 do…while Iteration Statement
  322. Section 5.6 switch Multiple-Selection Statement
  323. Section 5.7 Class AutoPolicy Case Study: Strings in switch Statements
  324. Section 5.8.1 break Statement
  325. Section 5.8.2 continue Statement
  326. Section 5.9 Logical Operators
  327. Section 5.9.1 Conditional AND (&&) Operator
  328. Section 5.9.2 Conditional OR (||) Operator
  329. Section 5.9.3 Short-Circuit Evaluation of Complex Conditions
  330. Section 5.9.4 Boolean Logical AND (&) and Boolean Logical Inclusive OR (|) Operators
  331. Section 5.9.5 Boolean Logical Exclusive OR (^)
  332. Section 5.9.6 Logical Negation (!) Operator
  333. Self-Review Exercises
  334. Answers to Self-Review Exercises
  335. Exercises
  336. Making a Difference
  337. 6 Methods: A Deeper Look
  338. Objectives
  339. Outline
  340. 6.1 Introduction
  341. 6.2 Program Units in Java
  342. 6.3 static Methods, static Fields and Class Math
  343. 6.4 Methods with Multiple Parameters
  344. 6.5 Notes on Declaring and Using Methods
  345. 6.6 Method-Call Stack and Activation Records
  346. 6.6.1 Method-Call Stack
  347. 6.6.2 Stack Frames
  348. 6.6.3 Local Variables and Stack Frames
  349. 6.6.4 Stack Overflow
  350. 6.7 Argument Promotion and Casting
  351. 6.8 Java API Packages
  352. 6.9 Case Study: Secure Random-Number Generation
  353. 6.10 Case Study: A Game of Chance; Introducing enum Types
  354. 6.11 Scope of Declarations
  355. 6.12 Method Overloading
  356. 6.12.1 Declaring Overloaded Methods
  357. 6.12.2 Distinguishing Between Overloaded Methods
  358. 6.12.3 Return Types of Overloaded Methods
  359. 6.13 (Optional) GUI and Graphics Case Study: Colors and Filled Shapes
  360. 6.14 Wrap-Up
  361. Summary
  362. Section 6.1 Introduction
  363. Section 6.2 Program Units in Java
  364. Section 6.3 static Methods, static Fields and Class Math
  365. Section 6.4 Methods with Multiple Parameters
  366. Section 6.5 Notes on Declaring and Using Methods
  367. Section 6.6 Method-Call Stack and Activation Records
  368. Section 6.7 Argument Promotion and Casting
  369. Section 6.9 Case Study: Secure Random-Number Generation
  370. Section 6.10 Case Study: A Game of Chance; Introducing enum Types
  371. Section 6.11 Scope of Declarations
  372. Section 6.12 Method Overloading
  373. Self-Review Exercises
  374. Answers to Self-Review Exercises
  375. Exercises
  376. Making a Difference
  377. 7 Arrays and ArrayLists
  378. Objectives
  379. Outline
  380. 7.1 Introduction
  381. 7.2 Arrays
  382. 7.3 Declaring and Creating Arrays
  383. 7.4 Examples Using Arrays
  384. 7.4.1 Creating and Initializing an Array
  385. 7.4.2 Using an Array Initializer
  386. 7.4.3 Calculating the Values to Store in an Array
  387. 7.4.4 Summing the Elements of an Array
  388. 7.4.5 Using Bar Charts to Display Array Data Graphically
  389. 7.4.6 Using the Elements of an Array as Counters
  390. 7.4.7 Using Arrays to Analyze Survey Results
  391. The frequency Array
  392. Summarizing the Results
  393. 7.5 Exception Handling: Processing the Incorrect Response
  394. 7.5.1 The try Statement
  395. 7.5.2 Executing the catch Block
  396. 7.5.3 toString Method of the Exception Parameter
  397. 7.6 Case Study: Card Shuffling and Dealing Simulation
  398. 7.7 Enhanced for Statement
  399. 7.8 Passing Arrays to Methods
  400. 7.9 Pass-By-Value vs. Pass-By-Reference
  401. 7.10 Case Study: Class GradeBook Using an Array to Store Grades
  402. 7.11 Multidimensional Arrays
  403. 7.11.1 Arrays of One-Dimensional Arrays
  404. 7.11.2 Two-Dimensional Arrays with Rows of Different Lengths
  405. 7.11.3 Creating Two-Dimensional Arrays with Array-Creation Expressions
  406. 7.11.4 Two-Dimensional Array Example: Displaying Element Values
  407. 7.11.5 Common Multidimensional-Array Manipulations Performed with for Statements
  408. 7.12 Case Study: Class GradeBook Using a Two-Dimensional Array
  409. 7.13 Variable-Length Argument Lists
  410. 7.14 Using Command-Line Arguments
  411. 7.15 Class Arrays
  412. 7.16 Introduction to Collections and Class ArrayList
  413. 7.17 (Optional) GUI and Graphics Case Study: Drawing Arcs
  414. 7.18 Wrap-Up
  415. Summary
  416. Section 7.1 Introduction
  417. Section 7.2 Arrays
  418. Section 7.3 Declaring and Creating Arrays
  419. Section 7.4 Examples Using Arrays
  420. Section 7.5 Exception Handling: Processing the Incorrect Response
  421. Section 7.6 Case Study: Card Shuffling and Dealing Simulation
  422. Section 7.7 Enhanced for Statement
  423. Section 7.8 Passing Arrays to Methods
  424. Section 7.9 Pass-By-Value vs. Pass-By-Reference
  425. Section 7.11 Multidimensional Arrays
  426. Section 7.13 Variable-Length Argument Lists
  427. Section 7.14 Using Command-Line Arguments
  428. Section 7.15 Class Arrays
  429. Section 7.16 Introduction to Collections and Class ArrayList
  430. Self-Review Exercises
  431. Answers to Self-Review Exercises
  432. Exercises
  433. Special Section: Building Your Own Computer
  434. Making a Difference
  435. 8 Classes and Objects: A Deeper Look
  436. Objectives
  437. Outline
  438. 8.1 Introduction
  439. 8.2 Time Class Case Study
  440. 8.3 Controlling Access to Members
  441. 8.4 Referring to the Current Object’s Members with the this Reference
  442. 8.5 Time Class Case Study: Overloaded Constructors
  443. 8.6 Default and No-Argument Constructors
  444. 8.7 Notes on Set and Get Methods
  445. 8.8 Composition
  446. 8.9 enum Types
  447. 8.10 Garbage Collection
  448. 8.11 static Class Members
  449. 8.12 static Import
  450. 8.13 final Instance Variables
  451. 8.14 Package Access
  452. 8.15 Using BigDecimal for Precise Monetary Calculations
  453. 8.16 (Optional) GUI and Graphics Case Study: Using Objects with Graphics
  454. 8.17 Wrap-Up
  455. Summary
  456. Section 8.2 Time Class Case Study
  457. Section 8.3 Controlling Access to Members
  458. Section 8.4 Referring to the Current Object’s Members with the this Reference
  459. Section 8.5 Time Class Case Study: Overloaded Constructors
  460. Section 8.6 Default and No-Argument Constructors
  461. Section 8.7 Notes on Set and Get Methods
  462. Section 8.8 Composition
  463. Section 8.9 enum Types
  464. Section 8.10 Garbage Collection
  465. Section 8.11 static Class Members
  466. Section 8.12 static Import
  467. Section 8.13 final Instance Variables
  468. Section 8.14 Package Access
  469. Section 8.15 Using BigDecimal for Precise Monetary Calculations
  470. Self-Review Exercises
  471. Answers to Self-Review Exercises
  472. Exercises
  473. Making a Difference
  474. 9 Object-Oriented Programming: Inheritance
  475. Objectives
  476. Outline
  477. 9.1 Introduction
  478. 9.2 Superclasses and Subclasses
  479. 9.3 protected Members
  480. 9.4 Relationship Between Superclasses and Subclasses
  481. 9.4.1 Creating and Using a CommissionEmployee Class
  482. Overview of Class CommissionEmployee’s Methods and Instance Variables
  483. Class CommissionEmployee’s Constructor
  484. Class CommissionEmployee’s earnings Method
  485. Class CommissionEmployee’s toString Method
  486. @Override Annotaton
  487. Class CommissionEmployeeTest
  488. 9.4.2 Creating and Using a BasePlusCommissionEmployee Class
  489. Testing Class BasePlusCommissionEmployee
  490. Notes on Class BasePlusCommissionEmployee
  491. 9.4.3 Creating a CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy
  492. A Subclass’s Constructor Must Call Its Superclass’s Constructor
  493. BasePlusCommissionEmployee Methods Earnings and toString
  494. 9.4.4 CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy Using protected Instance Variables
  495. Class BasePlusCommissionEmployee
  496. A Subclass Object Contains the Instance Variables of All of Its Superclasses
  497. Testing Class BasePlusCommissionEmployee
  498. Notes on Using protected Instance Variables
  499. 9.4.5 CommissionEmployee–BasePlusCommissionEmployee Inheritance Hierarchy Using private Instance Variables
  500. Class CommissionEmployee
  501. Class BasePlusCommissionEmployee
  502. Class BasePlusCommissionEmployee’s earnings Method
  503. Class BasePlusCommissionEmployee’s toString Method
  504. Testing Class BasePlusCommissionEmployee
  505. 9.5 Constructors in Subclasses
  506. 9.6 Class Object
  507. 9.7 Designing with Composition vs. Inheritance
  508. 9.8 Wrap-Up
  509. Summary
  510. Section 9.1 Introduction
  511. Section 9.2 Superclasses and Subclasses
  512. Section 9.3 protected Members
  513. Section 9.4 Relationship Between Superclasses and Subclasses
  514. Section 9.5 Constructors in Subclasses
  515. Section 9.6 Class Object
  516. Self-Review Exercises
  517. Answers to Self-Review Exercises
  518. Exercises
  519. 10 Object-Oriented Programming: Polymorphism and Interfaces
  520. Objectives
  521. Outline
  522. 10.1 Introduction
  523. 10.2 Polymorphism Examples
  524. 10.3 Demonstrating Polymorphic Behavior
  525. 10.4 Abstract Classes and Methods
  526. 10.5 Case Study: Payroll System Using Polymorphism
  527. 10.5.1 Abstract Superclass Employee
  528. 10.5.2 Concrete Subclass SalariedEmployee
  529. 10.5.3 Concrete Subclass HourlyEmployee
  530. 10.5.4 Concrete Subclass CommissionEmployee
  531. 10.5.5 Indirect Concrete Subclass BasePlusCommissionEmployee
  532. 10.5.6 Polymorphic Processing, Operator instanceof and Downcasting
  533. Creating the Array of Employees
  534. Polymorphically Processing Employees
  535. Performing Type-Specific Operations on BasePlusCommissionEmployees
  536. Calling earnings Polymorphically
  537. Getting Each Employee’s Class Name
  538. Avoiding Compilation Errors with Downcasting
  539. 10.6 Allowed Assignments Between Superclass and Subclass Variables
  540. 10.7 final Methods and Classes
  541. 10.8 A Deeper Explanation of Issues with Calling Methods from Constructors
  542. 10.9 Creating and Using Interfaces
  543. 10.9.1 Developing a Payable Hierarchy
  544. UML Diagram Containing an Interface
  545. 10.9.2 Interface Payable
  546. 10.9.3 Class Invoice
  547. A Class Can Extend Only One Other Class But Can Implement Many Interfaces
  548. 10.9.4 Modifying Class Employee to Implement Interface Payable
  549. Subclasses of Employee and Interface Payable
  550. 10.9.5 Using Interface Payable to Process Invoices and Employees Polymorphically
  551. 10.9.6 Some Common Interfaces of the Java API
  552. 10.10 Java SE 8 Interface Enhancements
  553. 10.10.1 default Interface Methods
  554. Adding Methods to Existing Interfaces
  555. Interfaces vs. abstract Classes
  556. 10.10.2 static Interface Methods
  557. 10.10.3 Functional Interfaces
  558. 10.11 Java SE 9 private Interface Methods
  559. 10.12 private Constructors
  560. 10.13 Program to an Interface, Not an Implementation3
  561. 10.13.1 Implementation Inheritance Is Best for Small Numbers of Tightly Coupled Classes
  562. 10.13.2 Interface Inheritance Is Best for Flexibility
  563. 10.13.3 Rethinking the Employee Hierarchy
  564. Flexibility if Compensation Models Change
  565. Flexibility if Employees Are Promoted
  566. Flexibility if Employees Acquire New Capabilities
  567. 10.14 (Optional) GUI and Graphics Case Study: Drawing with Polymorphism
  568. 10.15 Wrap-Up
  569. Summary
  570. Section 10.1 Introduction
  571. Section 10.3 Demonstrating Polymorphic Behavior
  572. Section 10.4 Abstract Classes and Methods
  573. Section 10.5 Case Study: Payroll System Using Polymorphism
  574. Section 10.6 Allowed Assignments Between Superclass and Subclass Variables
  575. Section 10.7 final Methods and Classes
  576. Section 10.8 A Deeper Explanation of Issues with Calling Methods from Constructors
  577. Section 10.9 Creating and Using Interfaces
  578. Section 10.10 Java SE 8 Interface Enhancements
  579. Section 10.11 Java SE 9 private Interface Methods
  580. Section 10.12 private Constructors
  581. Section 10.13 Program to an Interface, Not an Implementation
  582. Self-Review Exercises
  583. Answers to Self-Review Exercises
  584. Exercises
  585. Making a Difference
  586. 11 Exception Handling: A Deeper Look
  587. Objectives
  588. Outline
  589. 11.1 Introduction
  590. 11.2 Example: Divide by Zero without Exception Handling
  591. 11.3 Example: Handling ArithmeticExceptions and InputMismatchExceptions
  592. 11.4 When to Use Exception Handling
  593. 11.5 Java Exception Hierarchy
  594. 11.6 finally Block
  595. 11.7 Stack Unwinding and Obtaining Information from an Exception
  596. 11.8 Chained Exceptions
  597. 11.9 Declaring New Exception Types
  598. 11.10 Preconditions and Postconditions
  599. 11.11 Assertions
  600. 11.12 try-with-Resources: Automatic Resource Deallocation
  601. 11.13 Wrap-Up
  602. Summary
  603. Section 11.1 Introduction
  604. Section 11.2 Example: Divide by Zero without Exception Handling
  605. Section 11.3 Example: Handling ArithmeticExceptions and InputMismatchExceptions
  606. Section 11.4 When to Use Exception Handling
  607. Section 11.5 Java Exception Hierarchy
  608. Section 11.6 finally Block
  609. Section 11.7 Stack Unwinding and Obtaining Information from an Exception
  610. Section 11.8 Chained Exceptions
  611. Section 11.9 Declaring New Exception Types
  612. Section 11.10 Preconditions and Postconditions
  613. Section 11.11 Assertions
  614. Section 11.12 try-with-Resources: Automatic Resource Deallocation
  615. Self-Review Exercises
  616. Answers to Self-Review Exercises
  617. Exercises
  618. 12 JavaFX Graphical User Interfaces: Part 1
  619. Objectives
  620. Outline
  621. 12.1 Introduction
  622. 12.2 JavaFX Scene Builder
  623. 12.3 JavaFX App Window Structure
  624. 12.4 Welcome App—Displaying Text and an Image
  625. 12.4.1 Opening Scene Builder and Creating the File Welcome.fxml
  626. 12.4.2 Adding an Image to the Folder Containing Welcome.fxml
  627. 12.4.3 Creating a VBox Layout Container
  628. 12.4.4 Configuring the VBox Layout Container
  629. Specifying the VBox’s Alignment
  630. Specifying the VBox’s Preferred Size
  631. 12.4.5 Adding and Configuring a Label
  632. Adding a Label to the VBox
  633. Changing the Label’s Text
  634. Changing the Label’s Font
  635. 12.4.6 Adding and Configuring an ImageView
  636. Adding an ImageView to the VBox
  637. Setting the ImageView’s Image
  638. Changing the ImageView’s Size
  639. 12.4.7 Previewing the Welcome GUI
  640. 12.5 Tip Calculator App—Introduction to Event Handling
  641. 12.5.1 Test-Driving the Tip Calculator App
  642. Entering a Bill Total
  643. Selecting a Custom Tip Percentage
  644. 12.5.2 Technologies Overview
  645. Class Application
  646. Arranging JavaFX Components with a GridPane
  647. Creating and Customizing the GUI with Scene Builder
  648. Formatting Numbers as Locale-Specific Currency and Percentage Strings
  649. Event Handling
  650. Implementing Interface ChangeListener for Handling Slider Thumb Position Changes
  651. Model-View-Controller (MVC) Architecture
  652. FXMLLoader Class
  653. 12.5.3 Building the App’s GUI
  654. fx:id Property Values for This App’s Controls
  655. Creating the TipCalculator.fxml File
  656. Step 1: Adding a GridPane
  657. Step 2: Adding Rows to the GridPane
  658. Step 3: Adding the Controls to the GridPane
  659. Step 4: Sizing the GridPane to Fit Its Contents
  660. Step 5: Right-Aligning GridPane Column 0’s Contents
  661. Step 6: Sizing the GridPane Columns to Fit Their Contents
  662. Step 7: Sizing the Button
  663. Previewing the GUI
  664. Step 8: Configuring the GridPane’s Padding and Horizontal Gap Between Its Columns
  665. Step 9: Making the tipTextField and totalTextField Uneditable and Not Focusable
  666. Step 10: Setting the Slider’s Properties
  667. Previewing the Final Layout
  668. Specifying the Controller Class’s Name
  669. Specifying the Calculate Button’s Event-Handler Method Name
  670. Generating a Sample Controller Class
  671. 12.5.4 TipCalculator Class
  672. Overridden Application Method start
  673. Creating the Scene
  674. 12.5.5 TipCalculatorController Class
  675. Class TipCalculatorController’s import Statements
  676. TipCalculatorController’s static Variables and Instance Variables
  677. @FXML Annotation
  678. TipCalculatorController’s calculateButtonPressed Event Handler
  679. Registering the Calculate Button’s Event Handler
  680. Calculating and Displaying the Tip and Total Amounts
  681. TipCalculatorController’s initalize Method
  682. Using an Anonymous Inner Class for Event Handling
  683. Anonymous Inner Class Notes
  684. Java SE 8: Using a Lambda to Implement the ChangeListener
  685. 12.6 Features Covered in the Other JavaFX Chapters
  686. 12.7 Wrap-Up
  687. Summary
  688. Section 12.1 Introduction
  689. Section 12.2 JavaFX Scene Builder
  690. Section 12.3 JavaFX App Window Structure
  691. Section 12.4 Welcome App—Displaying Text and an Image
  692. Section 12.5.2 Technologies Overview
  693. Section 12.5.3 Building the App’s GUI
  694. Section 12.5.4 TipCalculator Class
  695. Section 12.5.5 TipCalculatorController Class
  696. Self-Review Exercises
  697. Answers to Self-Review Exercises
  698. Exercises
  699. Making a Difference
  700. 13 JavaFX GUI: Part 2
  701. Objectives
  702. Outline
  703. 13.1 Introduction
  704. 13.2 Laying Out Nodes in a Scene Graph
  705. 13.3 Painter App: RadioButtons, Mouse Events and Shapes
  706. 13.3.1 Technologies Overview
  707. RadioButtons and ToggleGroups
  708. BorderPane Layout Container
  709. TitledPane Layout Container
  710. JavaFX Shapes
  711. Pane Layout Container
  712. Mouse Event Handling
  713. Setting a Control’s User Data
  714. 13.3.2 Creating the Painter.fxml File
  715. 13.3.3 Building the GUI
  716. fx:id Property Values for This App’s Controls
  717. Step 1: Adding a BorderPane as the Root Layout Node
  718. Step 2: Configuring the BorderPane
  719. Step 3: Adding the VBox and Pane
  720. Step 4: Adding the TitledPanes to the VBox
  721. Step 5: Customizing the TitledPanes
  722. Step 6: Adding the RadioButtons to the VBox
  723. Step 7: Specifying the ToggleGroups for the RadioButtons
  724. Step 8: Changing the TitledPanes’ Preferred Width and Height
  725. Step 9: Adding the Buttons
  726. Step 10: Setting the Width the VBox
  727. Step 11: Specifying the Controller Class’s Name
  728. Step 12: Specifying the Event-Handler Method Names
  729. Step 13: Generating a Sample Controller Class
  730. 13.3.4 Painter Subclass of Application
  731. 13.3.5 PainterController Class
  732. PenSize enum
  733. Instance Variables
  734. Method initialize
  735. drawingAreaMouseDragged Event Handler
  736. colorRadioButtonSelected Event Handler
  737. sizeRadioButtonSelected Event Handler
  738. undoButtonPressed Event Handler
  739. clearButtonPressed Event Handler
  740. 13.4 Color Chooser App: Property Bindings and Property Listeners
  741. 13.4.1 Technologies Overview
  742. RGBA Colors
  743. Properties of a Class
  744. Property Bindings
  745. Property Listeners
  746. 13.4.2 Building the GUI
  747. fx:id Property Values for This App’s Controls
  748. Step 1: Adding a GridPane
  749. Step 2: Configuring the GridPane
  750. Step 3: Adding the Controls
  751. Step 4: Configuring the Sliders
  752. Step 5: Configuring the TextFields
  753. Step 6: Configuring the Rectangle
  754. Step 7: Configuring the Circle
  755. Step 8: Configuring the Rows
  756. Step 9: Configuring the Columns
  757. Step 10: Configuring the GridPane
  758. Step 11: Specifying the Controller Class’s Name
  759. Step 12: Generating a Sample Controller Class
  760. 13.4.3 ColorChooser Subclass of Application
  761. 13.4.4 ColorChooserController Class
  762. Instance Variables
  763. Method initialize
  764. Property-to-Property Bindings
  765. Property Listeners
  766. 13.5 Cover Viewer App: Data-Driven GUIs with JavaFX Collections
  767. 13.5.1 Technologies Overview
  768. 13.5.2 Adding Images to the App’s Folder
  769. 13.5.3 Building the GUI
  770. fx:id Property Values for This App’s Controls
  771. Adding and Configuring the Controls
  772. Specifying the Controller Class’s Name
  773. Generating a Sample Controller Class
  774. 13.5.4 CoverViewer Subclass of Application
  775. 13.5.5 CoverViewerController Class
  776. @FXML Instance Variables
  777. Instance Variable books
  778. Initializing the books ObservableList
  779. Listening for ListView Selection Changes
  780. 13.6 Cover Viewer App: Customizing ListView Cells
  781. 13.6.1 Technologies Overview
  782. ListCell Generic Class for Custom ListView Cell Formats
  783. Programmatically Creating Layouts and Controls
  784. 13.6.2 Copying the CoverViewer App
  785. 13.6.3 ImageTextCell Custom Cell Factory Class
  786. Constructor
  787. Method updateItem
  788. 13.6.4 CoverViewerController Class
  789. 13.7 Additional JavaFX Capabilities
  790. 13.8 JavaFX 9: Java SE 9 JavaFX Updates
  791. 13.9 Wrap-Up
  792. Summary
  793. Section 13.2 Laying Out Nodes in a Scene Graph
  794. Section 13.3.1 Technologies Overview
  795. Section 13.3.2 Creating the Painter.fxml File
  796. Section 13.3.3 Building the GUI
  797. Section 13.3.5 PainterController Class
  798. Section 13.4.1 Technologies Overview
  799. Section 13.4.2 Building the GUI
  800. Section 13.4.4 ColorChooserController Class
  801. Section 13.5 Cover Viewer App: Data-Driven GUIs with JavaFX Collections
  802. Section 13.5.1 Technologies Overview
  803. Section 13.5.5 CoverViewerController Class
  804. Section 13.6.1 Technologies Overview
  805. Section 13.6.3 ImageTextCell Custom Cell Factory Class
  806. Section 13.6.4 CoverViewerController Class
  807. Section 13.7 Additional JavaFX Capabilities
  808. Section 13.8 JavaFX 9: Java SE 9 JavaFX Updates
  809. Self-Review Exercises
  810. Answers to Self-Review Exercises
  811. Exercises
  812. (Optional) GUI and Graphics Case Study Exercise: Interactive Polymorphic Drawing App
  813. 14 Strings, Characters and Regular Expressions
  814. Objectives
  815. Outline
  816. 14.1 Introduction
  817. 14.2 Fundamentals of Characters and Strings
  818. 14.3 Class String
  819. 14.3.1 String Constructors
  820. 14.3.2 String Methods length, charAt and getChars
  821. 14.3.3 Comparing Strings
  822. String Method equals
  823. Comparing Strings with the == Operator
  824. String Method equalsIgnoreCase
  825. String Method compareTo
  826. String Method regionMatches
  827. String Methods startsWith and endsWith
  828. 14.3.4 Locating Characters and Substrings in Strings
  829. 14.3.5 Extracting Substrings from Strings
  830. 14.3.6 Concatenating Strings
  831. 14.3.7 Miscellaneous String Methods
  832. 14.3.8 String Method valueOf
  833. 14.4 Class StringBuilder
  834. 14.4.1 StringBuilder Constructors
  835. 14.4.2 StringBuilder Methods length, capacity, setLength and ensureCapacity
  836. 14.4.3 StringBuilder Methods charAt, setCharAt, getChars and reverse
  837. 14.4.4 StringBuilder append Methods
  838. 14.4.5 StringBuilder Insertion and Deletion Methods
  839. 14.5 Class Character
  840. 14.6 Tokenizing Strings
  841. 14.7 Regular Expressions, Class Pattern and Class Matcher
  842. 14.7.1 Replacing Substrings and Splitting Strings
  843. 14.7.2 Classes Pattern and Matcher
  844. Java SE 8
  845. Java SE 9: New Matcher Methods
  846. 14.8 Wrap-Up
  847. Summary
  848. Section 14.2 Fundamentals of Characters and Strings
  849. Section 14.3 Class String
  850. Section 14.4 Class StringBuilder
  851. Section 14.5 Class Character
  852. Section 14.6 Tokenizing Strings
  853. Section 14.7 Regular Expressions, Class Pattern and Class Matcher
  854. Self-Review Exercises
  855. Answers to Self-Review Exercises
  856. Exercises
  857. Special Section: String-Manipulation Exercises
  858. Special Section: Challenging String-Manipulation Projects
  859. Making a Difference
  860. 15 Files, Input/Output Streams, NIO and XML Serialization
  861. Objectives
  862. Outline
  863. 15.1 Introduction
  864. 15.2 Files and Streams
  865. 15.3 Using NIO Classes and Interfaces to Get File and Directory Information
  866. 15.4 Sequential Text Files
  867. 15.4.1 Creating a Sequential Text File
  868. Class CreateTextFile
  869. Writing Data to the File
  870. Sample Output
  871. 15.4.2 Reading Data from a Sequential Text File
  872. 15.4.3 Case Study: A Credit-Inquiry Program
  873. MenuOption enum
  874. CreditInquiry Class
  875. 15.4.4 Updating Sequential Files
  876. 15.5 XML Serialization
  877. 15.5.1 Creating a Sequential File Using XML Serialization
  878. Declaring Class Account
  879. Plain Old Java Objects
  880. Declaring Class Accounts
  881. Writing XML Serialized Objects to a File
  882. The XML Output
  883. 15.5.2 Reading and Deserializing Data from a Sequential File
  884. 15.6 FileChooser and DirectoryChooser Dialogs
  885. 15.7 (Optional) Additional java.io Classes
  886. 15.7.1 Interfaces and Classes for Byte-Based Input and Output
  887. Pipe Streams
  888. Filter Streams
  889. Data Streams
  890. Buffered Streams
  891. Memory-Based byte Array Steams
  892. Sequencing Input from Multiple Streams
  893. 15.7.2 Interfaces and Classes for Character-Based Input and Output
  894. Character-Based Buffering Readers and Writers
  895. Memory-Based char Array Readers and Writers
  896. Character-Based File, Pipe and String Readers and Writers
  897. 15.8 Wrap-Up
  898. Summary
  899. Section 15.1 Introduction
  900. Section 15.2 Files and Streams
  901. Section 15.3 Using NIO Classes and Interfaces to Get File and Directory Information
  902. Section 15.4 Sequential Text Files
  903. Section 15.5 XML Serialization
  904. Section 15.5.1 Creating a Sequential File Using XML Serialization
  905. Section 15.5.2 Reading and Deserializing Data from a Sequential File
  906. Section 15.6 FileChooser and DirectoryChooser Dialogs
  907. Section 15.7 (Optional) Additional java.io Classes
  908. Self-Review Exercises
  909. Answers to Self-Review Exercises
  910. Exercises
  911. Making a Difference
  912. 16 Generic Collections
  913. Objectives
  914. Outline
  915. 16.1 Introduction
  916. 16.2 Collections Overview
  917. 16.3 Type-Wrapper Classes
  918. 16.4 Autoboxing and Auto-Unboxing
  919. 16.5 Interface Collection and Class Collections
  920. 16.6 Lists
  921. 16.6.1 ArrayList and Iterator
  922. Type Inference with the <> Notation
  923. 16.6.2 LinkedList
  924. Method convertToUppercaseStrings
  925. Method removeItems
  926. Method printReversedList
  927. Views into Collections and Arrays Method asList
  928. Viewing Arrays as Lists and Converting Lists to Arrays
  929. 16.7 Collections Methods
  930. 16.7.1 Method sort
  931. Sorting in Ascending Order
  932. Sorting in Descending Order
  933. Sorting with a Comparator
  934. 16.7.2 Method shuffle
  935. 16.7.3 Methods reverse, fill, copy, max and min
  936. 16.7.4 Method binarySearch
  937. 16.7.5 Methods addAll, frequency and disjoint
  938. 16.8 Class PriorityQueue and Interface Queue
  939. 16.9 Sets
  940. 16.10 Maps
  941. 16.11 Synchronized Collections
  942. 16.12 Unmodifiable Collections
  943. 16.13 Abstract Implementations
  944. 16.14 Java SE 9: Convenience Factory Methods for Immutable Collections1
  945. 16.15 Wrap-Up
  946. Summary
  947. Section 16.1 Introduction
  948. Section 16.2 Collections Overview
  949. Section 16.3 Type-Wrapper Classes
  950. Section 16.4 Autoboxing and Auto-Unboxing
  951. Section 16.5 Interface Collection and Class Collections
  952. Section 16.6 Lists
  953. Section 16.7 Collections Methods
  954. Section 16.8 Class PriorityQueue and Interface Queue
  955. Section 16.9 Sets
  956. Section 16.10 Maps
  957. Section 16.11 Synchronized Collections
  958. Section 16.12 Unmodifiable Collections
  959. Section 16.13 Abstract Implementations
  960. Section 16.14 Java SE 9: Convenience Factory Methods for Immutable Collections
  961. Self-Review Exercises
  962. Answers to Self-Review Exercises
  963. Exercises
  964. 17 Lambdas and Streams
  965. Objectives
  966. Outline
  967. 17.1 Introduction1
  968. 17.2 Streams and Reduction
  969. 17.2.1 Summing the Integers from 1 through 10 with a for Loop
  970. 17.2.2 External Iteration with for Is Error Prone
  971. 17.2.3 Summing with a Stream and Reduction
  972. Streams and Stream Pipelines
  973. Specifying the Data Source
  974. Calculating the Sum of the IntStream’s Elements
  975. Processing the Stream Pipeline
  976. 17.2.4 Internal Iteration
  977. 17.3 Mapping and Lambdas
  978. 17.3.1 Lambda Expressions
  979. 17.3.2 Lambda Syntax
  980. Eliminating a Lambda’s Parameter Type(s)
  981. Simplifying the Lambda’s Body
  982. Simplifying the Lambda’s Parameter List
  983. Lambdas with Empty Parameter Lists
  984. Method References
  985. 17.3.3 Intermediate and Terminal Operations
  986. Lazy and Eager Operations
  987. 17.4 Filtering
  988. 17.5 How Elements Move Through Stream Pipelines
  989. 17.6 Method References
  990. 17.6.1 Creating an IntStream of Random Values
  991. 17.6.2 Performing a Task on Each Stream Element with forEach and a Method Reference
  992. 17.6.3 Mapping Integers to String Objects with mapToObj
  993. 17.6.4 Concatenating Strings with collect
  994. 17.7 IntStream Operations
  995. 17.7.1 Creating an IntStream and Displaying Its Values
  996. 17.7.2 Terminal Operations count, min, max, sum and average
  997. 17.7.3 Terminal Operation reduce
  998. Calculating the Product of the Values with Method reduce
  999. Summing the Squares of the Values
  1000. 17.7.4 Sorting IntStream Values
  1001. 17.8 Functional Interfaces
  1002. 17.9 Lambdas: A Deeper Look
  1003. 17.10 Stream<Integer> Manipulations
  1004. 17.10.1 Creating a Stream<Integer>
  1005. 17.10.2 Sorting a Stream and Collecting the Results
  1006. Creating a New Collection Containing a Stream Pipeline’s Results
  1007. 17.10.3 Filtering a Stream and Storing the Results for Later Use
  1008. 17.10.4 Filtering and Sorting a Stream and Collecting the Results
  1009. 17.10.5 Sorting Previously Collected Results
  1010. 17.11 Stream<String> Manipulations
  1011. 17.11.1 Mapping Strings to Uppercase
  1012. 17.11.2 Filtering Strings Then Sorting Them in Case-Insensitive Ascending Order
  1013. 17.11.3 Filtering Strings Then Sorting Them in Case-Insensitive Descending Order
  1014. 17.12 Stream<Employee> Manipulations
  1015. 17.12.1 Creating and Displaying a List<Employee>
  1016. Java SE 9: Creating an Immutable List<Employee> with List Method of
  1017. 17.12.2 Filtering Employees with Salaries in a Specified Range
  1018. Short-Circuit Stream Pipeline Processing
  1019. 17.12.3 Sorting Employees By Multiple Fields
  1020. Aside: Composing Lambda Expressions
  1021. 17.12.4 Mapping Employees to Unique-Last-Name Strings
  1022. 17.12.5 Grouping Employees By Department
  1023. 17.12.6 Counting the Number of Employees in Each Department
  1024. 17.12.7 Summing and Averaging Employee Salaries
  1025. 17.13 Creating a Stream<String> from a File
  1026. 17.14 Streams of Random Values
  1027. 17.15 Infinite Streams
  1028. 17.16 Lambda Event Handlers
  1029. 17.17 Additional Notes on Java SE 8 Interfaces
  1030. 17.18 Wrap-Up
  1031. Summary
  1032. Section 17.1 Introduction
  1033. Section 17.2 Streams and Reduction
  1034. Section 17.2.1 Summing the Integers from 1 through 10 with a for Loop
  1035. Section 17.2.2 External Iteration with for Is Error Prone
  1036. Section 17.2.3 Summing with a Stream and Reduction
  1037. Section 17.2.4 Internal Iteration
  1038. Section 17.3 Mapping and Lambdas
  1039. Section 17.3.1 Lambda Expressions
  1040. Section 17.3.2 Lambda Syntax
  1041. Section 17.3.3 Intermediate and Terminal Operations
  1042. Section 17.4 Filtering
  1043. Section 17.5 How Elements Move Through Stream Pipelines
  1044. Section 17.6 Method References
  1045. Section 17.6.1 Creating an IntStream of Random Values
  1046. Section 17.6.2 Performing a Task on Each Stream Element with forEach and a Method Reference
  1047. Section 17.6.3 Mapping Integers to String Objects with mapToObj
  1048. Section 17.6.4 Concatenating Strings with collect
  1049. Section 17.7 IntStream Operations
  1050. Section 17.7.1 Creating an IntStream and Displaying Its Values
  1051. Section 17.7.2 Terminal Operations count, min, max, sum and average
  1052. Section 17.7.3 Terminal Operation reduce
  1053. Section 17.7.4 Sorting IntStream Values
  1054. Section 17.8 Functional Interfaces
  1055. Section 17.9 Lambdas: A Deeper Look
  1056. Section 17.10 Stream<Integer> Manipulations
  1057. Section 17.10.1 Creating a Stream<Integer>
  1058. Section 17.10.2 Sorting a Stream and Collecting the Results
  1059. Section 17.10.3 Filtering a Stream and Storing the Results for Later Use
  1060. Section 17.10.5 Sorting Previously Collected Results
  1061. Section 17.11.1 Mapping Strings to Uppercase
  1062. Section 17.11.2 Filtering Strings Then Sorting Them in Case-Insensitive Ascending Order
  1063. Section 17.11.3 Filtering Strings Then Sorting Them in Case-Insensitive Descending Order
  1064. Section 17.12.1 Creating and Displaying a List<Employee>
  1065. Section 17.12.2 Filtering Employees with Salaries in a Specified Range
  1066. Section 17.12.3 Sorting Employees By Multiple Fields
  1067. Section 17.12.4 Mapping Employees to Unique Last Name Strings
  1068. Section 17.12.5 Grouping Employees By Department
  1069. Section 17.12.6 Counting the Number of Employees in Each Department
  1070. Section 17.12.7 Summing and Averaging Employee Salaries
  1071. Section 17.13 Creating a Stream<String> from a File
  1072. Section 17.14 Streams of Random Values
  1073. Section 17.15 Infinite Streams
  1074. Section 17.16 Lambda Event Handlers
  1075. Section 17.17 Additional Notes on Java SE 8 Interfaces
  1076. Self-Review Exercises
  1077. Answers to Self-Review Exercises
  1078. Exercises
  1079. 18 Recursion
  1080. Objectives
  1081. Outline
  1082. 18.1 Introduction
  1083. 18.2 Recursion Concepts
  1084. 18.3 Example Using Recursion: Factorials
  1085. 18.4 Reimplementing Class FactorialCalculator Using BigInteger
  1086. 18.5 Example Using Recursion: Fibonacci Series
  1087. 18.6 Recursion and the Method-Call Stack
  1088. 18.7 Recursion vs. Iteration
  1089. 18.8 Towers of Hanoi
  1090. 18.9 Fractals
  1091. 18.9.1 Koch Curve Fractal
  1092. 18.9.2 (Optional) Case Study: Lo Feather Fractal
  1093. 18.9.3 (Optional) Fractal App GUI
  1094. ToolBar and Its Additional Controls
  1095. ColorPicker
  1096. Event Handlers
  1097. 18.9.4 (Optional) FractalController Class
  1098. FractalController Fields
  1099. initialize Method
  1100. colorSelected Event Handler
  1101. decreaseLevelButtonPressed and increaseLevelButtonPressed Event Handlers
  1102. drawFractal Method with No Arguments
  1103. drawFractal Method with Five Arguments
  1104. 18.10 Recursive Backtracking
  1105. 18.11 Wrap-Up
  1106. Summary
  1107. Section 18.1 Introduction
  1108. Section 18.2 Recursion Concepts
  1109. Section 18.3 Example Using Recursion: Factorials
  1110. Section 18.5 Example Using Recursion: Fibonacci Series
  1111. Section 18.6 Recursion and the Method-Call Stack
  1112. Section 18.7 Recursion vs. Iteration
  1113. Section 18.9 Fractals
  1114. Section 18.10 Recursive Backtracking
  1115. Self-Review Exercises
  1116. Answers to Self-Review Exercises
  1117. Exercises
  1118. Lambdas and Streams Exercises
  1119. 19 Searching, Sorting and Big O
  1120. Objectives
  1121. Outline
  1122. 19.1 Introduction
  1123. 19.2 Linear Search
  1124. 19.3 Big O Notation
  1125. 19.3.1 O(1) Algorithms
  1126. 19.3.2 O(n) Algorithms
  1127. 19.3.3 O(n2) Algorithms
  1128. 19.3.4 Big O of the Linear Search
  1129. 19.4 Binary Search
  1130. 19.4.1 Binary Search Implementation
  1131. 19.4.2 Efficiency of the Binary Search
  1132. 19.5 Sorting Algorithms
  1133. 19.6 Selection Sort
  1134. 19.6.1 Selection Sort Implementation
  1135. Methods selectionSort and swap
  1136. Methods printPass
  1137. 19.6.2 Efficiency of the Selection Sort
  1138. 19.7 Insertion Sort
  1139. 19.7.1 Insertion Sort Implementation
  1140. Method insertionSort
  1141. Method printPass
  1142. 19.7.2 Efficiency of the Insertion Sort
  1143. 19.8 Merge Sort
  1144. 19.8.1 Merge Sort Implementation
  1145. Method mergeSort
  1146. Recursive Method sortArray
  1147. Method merge
  1148. 19.8.2 Efficiency of the Merge Sort
  1149. 19.9 Big O Summary for This Chapter’s Searching and Sorting Algorithms
  1150. 19.10 Massive Parallelism and Parallel Algorithms
  1151. 19.11 Wrap-Up
  1152. Summary
  1153. Section 19.1 Introduction
  1154. Section 19.2 Linear Search
  1155. Section 19.3 Big O Notation
  1156. Section 19.4 Binary Search
  1157. Section 19.6 Selection Sort
  1158. Section 19.7 Insertion Sort
  1159. Section 19.8 Merge Sort
  1160. Self-Review Exercises
  1161. Answers to Self-Review Exercises
  1162. Exercises
  1163. Making a Difference
  1164. 20 Generic Classes and Methods: A Deeper Look
  1165. Objectives
  1166. Outline
  1167. 20.1 Introduction
  1168. 20.2 Motivation for Generic Methods
  1169. 20.3 Generic Methods: Implementation and Compile-Time Translation
  1170. 20.4 Additional Compile-Time Translation Issues: Methods That Use a Type Parameter as the Return Type
  1171. 20.5 Overloading Generic Methods
  1172. 20.6 Generic Classes
  1173. 20.7 Wildcards in Methods That Accept Type Parameters
  1174. 20.8 Wrap-Up
  1175. Summary
  1176. Section 20.1 Introduction
  1177. Section 20.2 Motivation for Generic Methods
  1178. Section 20.3 Generic Methods: Implementation and Compile-Time Translation
  1179. Section 20.4 Additional Compile-Time Translation Issues: Methods That Use a Type Parameter as the Return Type
  1180. Section 20.5 Overloading Generic Methods
  1181. Section 20.6 Generic Classes
  1182. Section 20.7 Wildcards in Methods That Accept Type Parameters
  1183. Self-Review Exercises
  1184. Answers to Self-Review Exercises
  1185. Exercises
  1186. 21 Custom Generic Data Structures
  1187. Objectives
  1188. Outline
  1189. 21.1 Introduction
  1190. 21.2 Self-Referential Classes
  1191. 21.3 Dynamic Memory Allocation
  1192. 21.4 Linked Lists
  1193. 21.4.1 Singly Linked Lists
  1194. 21.4.2 Implementing a Generic List Class
  1195. 21.4.3 Generic Classes ListNode and List
  1196. 21.4.4 Class ListTest
  1197. 21.4.5 List Method insertAtFront
  1198. 21.4.6 List Method insertAtBack
  1199. 21.4.7 List Method removeFromFront
  1200. 21.4.8 List Method removeFromBack
  1201. 21.4.9 List Method print
  1202. 21.4.10 Creating Your Own Packages
  1203. Steps for Declaring a Reusable Class
  1204. Step 1: Creating public Types for Reuse
  1205. Step 2: Adding the package Statements
  1206. Package Naming Conventions
  1207. Fully Qualified Names
  1208. Step 3: Compiling Packaged Types
  1209. Step 4: Importing Types from Your Package
  1210. Single-Type-Import vs. Type-Import-On-Demand Declarations
  1211. Specifying the Classpath When Compiling a Program
  1212. Specifying the Classpath When Executing a Program
  1213. 21.5 Stacks
  1214. 21.6 Queues
  1215. 21.7 Trees
  1216. 21.8 Wrap-Up
  1217. Summary
  1218. Section 21.1 Introduction
  1219. Section 21.2 Self-Referential Classes
  1220. Section 21.3 Dynamic Memory Allocation
  1221. Section 21.4 Linked Lists
  1222. Section 21.5 Stacks
  1223. Section 21.6 Queues
  1224. Section 21.7 Trees
  1225. Self-Review Exercises
  1226. Answers to Self-Review Exercises
  1227. Exercises
  1228. Special Section: Building Your Own Compiler
  1229. First Pass
  1230. Second Pass
  1231. A Complete Example
  1232. A Step-by-Step View of the Compilation Process
  1233. 22 JavaFX Graphics and Multimedia
  1234. Objectives
  1235. Outline
  1236. 22.1 Introduction
  1237. 22.2 Controlling Fonts with Cascading Style Sheets (CSS)
  1238. 22.2.1 CSS That Styles the GUI
  1239. .vbox CSS Rule—Style Class Selectors
  1240. #label1 CSS Rule—ID Selectors
  1241. #label2 CSS Rule
  1242. #label3 CSS Rule
  1243. #label4 CSS Rule
  1244. #label5 CSS Rule
  1245. #label5 .text CSS Rule
  1246. 22.2.2 FXML That Defines the GUI—Introduction to XML Markup2
  1247. XML Declaration
  1248. Attributes
  1249. Comments
  1250. FXML import Declarations
  1251. Elements
  1252. XML Namespaces
  1253. 22.2.3 Referencing the CSS File from FXML
  1254. 22.2.4 Specifying the VBox’s Style Class
  1255. 22.2.5 Programmatically Loading CSS
  1256. 22.3 Displaying Two-Dimensional Shapes
  1257. 22.3.1 Defining Two-Dimensional Shapes with FXML
  1258. Line Objects
  1259. Rectangle Object
  1260. Circle Object
  1261. Ellipse Object
  1262. Arc Object
  1263. 22.3.2 CSS That Styles the Two-Dimensional Shapes
  1264. Specifying Common Attributes for Various Objects
  1265. Styling the Lines
  1266. Styling the Rectangle
  1267. Styling the Circle
  1268. Styling the Ellipse
  1269. Styling the Arc
  1270. 22.4 Polylines, Polygons and Paths
  1271. 22.4.1 GUI and CSS
  1272. 22.4.2 PolyShapesController Class
  1273. Method initialize
  1274. Method drawingAreaMouseClicked
  1275. Method shapeRadioButtonSelected
  1276. Method displayShape
  1277. Method clearButtonPressed
  1278. 22.5 Transforms
  1279. 22.6 Playing Video with Media, MediaPlayer and MediaViewer
  1280. 22.6.1 VideoPlayer GUI
  1281. 22.6.2 VideoPlayerController Class
  1282. Instance Variables
  1283. Creating a Media Object Representing the Video to Play
  1284. Creating a MediaPlayer Object to Load the Video and Control Playback
  1285. Attaching the MediaPlayer Object to the MediaView to Display the Video
  1286. Configuring Event Handlers for MediaPlayer Events
  1287. Binding the MediaViewer’s Size to the Scene’s Size
  1288. Method playPauseButtonPressed
  1289. Using Java SE 8 Lambdas to Implement the Runnables
  1290. 22.7 Transition Animations
  1291. 22.7.1 TransitionAnimations.fxml
  1292. 22.7.2 TransitionAnimationsController Class
  1293. FillTransition
  1294. StrokeTransition
  1295. ParallelTransition
  1296. FadeTransition
  1297. RotateTransition
  1298. PathTransition
  1299. ScaleTransition
  1300. SequentialTransition
  1301. 22.8 Timeline Animations
  1302. 22.9 Frame-by-Frame Animation with AnimationTimer
  1303. 22.10 Drawing on a Canvas
  1304. 22.11 Three-Dimensional Shapes
  1305. 22.12 Wrap-Up
  1306. Summary
  1307. Section 22.2 Controlling Fonts with Cascading Style Sheets (CSS)
  1308. Section 22.2.1 CSS That Styles the GUI
  1309. Section 22.2.2 FXML That Defines the GUI—Introduction to XML Markup
  1310. Section 22.2.3 Referencing the CSS File from FXML
  1311. Section 22.2.4 Specifying the VBox’s Style Class
  1312. Section 22.2.5 Programmatically Loading CSS
  1313. Section 22.3 Displaying Two-Dimensional Shapes
  1314. Section 22.3.1 Defining Two-Dimensional Shapes with FXML
  1315. Section 22.3.2 CSS That Styles the Two-Dimensional Shapes
  1316. Section 22.4 Polylines, Polygons and Paths
  1317. Section 22.4.2 PolyshapesController Class
  1318. Section 22.5 Transforms
  1319. Section 22.6 Playing Video with Media, MediaPlayer and MediaViewer
  1320. Section 22.6.1 VideoPlayer GUI
  1321. Section 22.6.2 VideoPlayerController Class
  1322. Section 22.7 Transition Animations
  1323. Section 22.7.2 TransitionAnimationsController Class
  1324. Section 22.8 Timeline Animations
  1325. Section 22.9 Frame-By-Frame Animation with AnimationTimer
  1326. Section 22.10 Drawing on a Canvas
  1327. Section 22.11 Three-Dimensional Shapes
  1328. Self-Review Exercises
  1329. Answers to Self-Review Exercises
  1330. Exercises
  1331. Project Exercises
  1332. 23 Concurrency
  1333. Objectives
  1334. Outline
  1335. 23.1 Introduction
  1336. 23.2 Thread States and Life Cycle
  1337. 23.2.1 New and Runnable States
  1338. 23.2.2 Waiting State
  1339. 23.2.3 Timed Waiting State
  1340. 23.2.4 Blocked State
  1341. 23.2.5 Terminated State
  1342. 23.2.6 Operating-System View of the Runnable State
  1343. 23.2.7 Thread Priorities and Thread Scheduling
  1344. 23.2.8 Indefinite Postponement and Deadlock
  1345. 23.3 Creating and Executing Threads with the Executor Framework
  1346. 23.4 Thread Synchronization
  1347. 23.4.1 Immutable Data
  1348. 23.4.2 Monitors
  1349. 23.4.3 Unsynchronized Mutable Data Sharing
  1350. Class SimpleArray
  1351. Class ArrayWriter
  1352. Class SharedArrayTest
  1353. ExecutorService Method awaitTermination
  1354. Sample Program Output
  1355. 23.4.4 Synchronized Mutable Data Sharing—Making Operations Atomic
  1356. Class SimpleArray with Synchronization
  1357. 23.5 Producer/Consumer Relationship without Synchronization
  1358. 23.6 Producer/Consumer Relationship: ArrayBlockingQueue
  1359. 23.7 (Advanced) Producer/Consumer Relationship with synchronized, wait, notify and notifyAll
  1360. 23.8 (Advanced) Producer/Consumer Relationship: Bounded Buffers
  1361. 23.9 (Advanced) Producer/Consumer Relationship: The Lock and Condition Interfaces
  1362. 23.10 Concurrent Collections
  1363. 23.11 Multithreading in JavaFX
  1364. 23.11.1 Performing Computations in a Worker Thread: Fibonacci Numbers
  1365. Creating a Task
  1366. FibonacciNumbers GUI
  1367. Class FibonacciNumbersController
  1368. Method goButtonPressed
  1369. Method nextNumberButtonPressed
  1370. 23.11.2 Processing Intermediate Results: Sieve of Eratosthenes
  1371. A Task to Find Prime Numbers
  1372. Constructor
  1373. Sieve of Eratosthenes
  1374. Overridden Task Method call
  1375. FindPrimes GUI
  1376. Class FindPrimesController
  1377. Method getPrimesButtonPressed
  1378. Method cancelButtonPressed
  1379. 23.12 sort/parallelSort Timings with the Java SE 8 Date/Time API
  1380. 23.13 Java SE 8: Sequential vs. Parallel Streams
  1381. 23.14 (Advanced) Interfaces Callable and Future
  1382. 23.15 (Advanced) Fork/Join Framework
  1383. 23.16 Wrap-Up
  1384. Summary
  1385. Section 23.1 Introduction
  1386. Section 23.2 Thread States and Life Cycle
  1387. Section 23.3 Creating and Executing Threads with the Executor Framework
  1388. Section 23.4 Thread Synchronization
  1389. Section 23.5 Producer/Consumer Relationship without Synchronization
  1390. Section 23.6 Producer/Consumer Relationship: ArrayBlockingQueue
  1391. Section 23.7 (Advanced) Producer/Consumer Relationship with synchronized, wait, notify and notifyAll
  1392. Section 23.8 (Advanced) Producer/Consumer Relationship: Bounded Buffers
  1393. Section 23.10 Concurrent Collections
  1394. Section 23.11 Multithreading in JavaFX
  1395. Section 23.11.1 Performing Computations in a Worker Thread: Fibonacci Numbers
  1396. Section 23.11.2 Processing Intermediate Results: Sieve of Eratosthenes
  1397. Section 23.12 sort/parallelSort Timings with the Java SE 8 Date/Time API
  1398. Section 23.13 Java SE 8: Sequential vs. Parallel Streams
  1399. Section 23.14 (Advanced) Interfaces Callable and Future
  1400. Section 23.15 (Advanced) Fork/Join Framework
  1401. Self-Review Exercises
  1402. Exercises
  1403. Exercises
  1404. Parallel Streams
  1405. Parallel Sorting and Searching Projects
  1406. 24 Accessing Databases with JDBC
  1407. Objectives
  1408. Outline
  1409. 24.1 Introduction
  1410. 24.2 Relational Databases
  1411. 24.3 A books Database
  1412. 24.4 SQL
  1413. 24.4.1 Basic SELECT Query
  1414. 24.4.2 WHERE Clause
  1415. Pattern Matching: Zero or More Characters
  1416. Pattern Matching: Any Character
  1417. 24.4.3 ORDER BY Clause
  1418. Sorting in Descending Order
  1419. Sorting By Multiple Columns
  1420. Combining the WHERE and ORDER BY Clauses
  1421. 24.4.4 Merging Data from Multiple Tables: INNER JOIN
  1422. 24.4.5 INSERT Statement
  1423. 24.4.6 UPDATE Statement
  1424. 24.4.7 DELETE Statement
  1425. 24.5 Setting Up a Java DB Database 1
  1426. 24.5.1 Creating the Chapter’s Databases on Windows
  1427. 24.5.2 Creating the Chapter’s Databases on macOS
  1428. 24.5.3 Creating the Chapter’s Databases on Linux
  1429. 24.6 Connecting to and Querying a Database
  1430. 24.6.1 Automatic Driver Discovery
  1431. 24.6.2 Connecting to the Database
  1432. 24.6.3 Creating a Statement for Executing Queries
  1433. 24.6.4 Executing a Query
  1434. 24.6.5 Processing a Query’s ResultSet
  1435. 24.7 Querying the books Database
  1436. 24.7.1 ResultSetTableModel Class
  1437. ResultSetTableModel Constructor
  1438. ResultSetTableModel Method getColumnClass
  1439. ResultSetTableModel Method getColumnCount
  1440. ResultSetTableModel Method getColumnName
  1441. ResultSetTableModel Method getRowCount
  1442. ResultSetTableModel Method getValueAt
  1443. ResultSetTableModel Method setQuery
  1444. ResultSetTableModel Method disconnectFromDatabase
  1445. 24.7.2 DisplayQueryResults App’s GUI
  1446. 24.7.3 DisplayQueryResultsController Class
  1447. static Fields
  1448. Method initialize
  1449. Method submitQueryButtonPressed
  1450. Method applyFilterButtonPressed
  1451. Method displayAlert
  1452. 24.8 RowSet Interface
  1453. 24.9 PreparedStatements
  1454. 24.9.1 AddressBook App That Uses PreparedStatements
  1455. 24.9.2 Class Person
  1456. 24.9.3 Class PersonQueries
  1457. Creating PreparedStatements
  1458. PersonQueries Method getAllPeople
  1459. PersonQueries Method getPeopleByLastName
  1460. PersonQueries Methods addPerson and Close
  1461. 24.9.4 AddressBook GUI
  1462. 24.9.5 Class AddressBookController
  1463. Instance Variables
  1464. Method initialize
  1465. Methods getAllEntries and selectFirstEntry
  1466. Method displayContact
  1467. Method addEntryButtonPressed
  1468. Method findButtonPressed
  1469. Method browseAllButtonPressed
  1470. 24.10 Stored Procedures
  1471. 24.11 Transaction Processing
  1472. 24.12 Wrap-Up
  1473. Summary
  1474. Section 24.1 Introduction
  1475. Section 24.2 Relational Databases
  1476. Section 24.3 A books Database
  1477. Section 24.4.1 Basic SELECT Query
  1478. Section 24.4.2 WHERE Clause
  1479. Section 24.4.3 ORDER BY Clause
  1480. Section 24.4.4 Merging Data from Multiple Tables: INNER JOIN
  1481. Section 24.4.5 INSERT Statement
  1482. Section 24.4.6 UPDATE Statement
  1483. Section 24.4.7 DELETE Statement
  1484. Section 24.5 Setting Up a Java DB Database
  1485. Section 24.6 Connecting to and Querying a Database
  1486. Section 24.7 Querying the books Database
  1487. Section 24.8 RowSet Interface
  1488. Section 24.9 PreparedStatements
  1489. Section 24.10 Stored Procedures
  1490. Section 24.11 Transaction Processing
  1491. Self-Review Exercises
  1492. Answers to Self-Review Exercise
  1493. Exercises
  1494. 25 Introduction to JShell: Java 9’s REPL for Interactive Java
  1495. Objectives
  1496. Outline
  1497. 25.1 Introduction
  1498. 25.2 Installing JDK 9
  1499. 25.3 Introduction to JShell
  1500. 25.3.1 Starting a JShell Session
  1501. 25.3.2 Executing Statements
  1502. 25.3.3 Declaring Variables Explicitly
  1503. Compilation Errors in JShell
  1504. Fixing the Error
  1505. Recalling and Re-executing a Previous Snippet
  1506. 25.3.4 Listing and Executing Prior Snippets
  1507. Executing Snippets By ID Number
  1508. 25.3.5 Evaluating Expressions and Declaring Variables Implicitly
  1509. 25.3.6 Using Implicitly Declared Variables
  1510. 25.3.7 Viewing a Variable’s Value
  1511. 25.3.8 Resetting a JShell Session
  1512. 25.3.9 Writing Multiline Statements
  1513. 25.3.10 Editing Code Snippets
  1514. Editing a Single-Line Snippet
  1515. Editing a Multiline Snippet
  1516. Adding a New Snippet Via JShell Edit Pad
  1517. Executing the New if Statement Again
  1518. 25.3.11 Exiting JShell
  1519. 25.4 Command-Line Input in JShell
  1520. 25.5 Declaring and Using Classes
  1521. 25.5.1 Creating a Class in JShell
  1522. Viewing Declared Classes
  1523. 25.5.2 Explicitly Declaring Reference-Type Variables
  1524. 25.5.3 Creating Objects
  1525. Declaring an Implicit Account Variable Initialized with an Account Object
  1526. Viewing Declared Variables
  1527. 25.5.4 Manipulating Objects
  1528. Using the Return Value of a Method in a Statement
  1529. 25.5.5 Creating a Meaningful Variable Name for an Expression
  1530. 25.5.6 Saving and Opening Code-Snippet Files
  1531. Saving Snippets to a File
  1532. Loading Snippets from a File
  1533. Using /open to Load Java Source-Code Files
  1534. 25.6 Discovery with JShell Auto-Completion
  1535. 25.6.1 Auto-Completing Identifiers
  1536. 25.6.2 Auto-Completing JShell Commands
  1537. 25.7 Exploring a Class’s Members and Viewing Documentation
  1538. 25.7.1 Listing Class Math’s static Members
  1539. 25.7.2 Viewing a Method’s Parameters
  1540. 25.7.3 Viewing a Method’s Documentation
  1541. 25.7.4 Viewing a public Field’s Documentation
  1542. 25.7.5 Viewing a Class’s Documentation
  1543. 25.7.6 Viewing Method Overloads
  1544. 25.7.7 Exploring Members of a Specific Object
  1545. Exploring toUpperCase
  1546. Exploring substring
  1547. 25.8 Declaring Methods
  1548. 25.8.1 Forward Referencing an Undeclared Method—Declaring Method displayCubes
  1549. 25.8.2 Declaring a Previously Undeclared Method
  1550. 25.8.3 Testing cube and Replacing Its Declaration
  1551. 25.8.4 Testing Updated Method cube and Method displayCubes
  1552. 25.9 Exceptions
  1553. 25.10 Importing Classes and Adding Packages to the CLASSPATH
  1554. 25.11 Using an External Editor
  1555. 25.12 Summary of JShell Commands
  1556. 25.12.1 Getting Help in JShell
  1557. 25.12.2 /edit Command: Additional Features
  1558. 25.12.3 /reload Command
  1559. 25.12.4 /drop Command
  1560. 25.12.5 Feedback Modes
  1561. Feedback Mode verbose
  1562. Feedback Mode concise
  1563. Feedback Mode silent
  1564. 25.12.6 Other JShell Features Configurable with /set
  1565. Customizing JShell Startup
  1566. 25.13 Keyboard Shortcuts for Snippet Editing
  1567. 25.14 How JShell Reinterprets Java for Interactive Use
  1568. 25.15 IDE JShell Support
  1569. 25.16 Wrap-Up
  1570. Self-Review Exercises
  1571. Answers to Self-Review Exercises
  1572. Chapters on the Web
  1573. A Operator Precedence Chart
  1574. B ASCII Character Set
  1575. C Keywords and Reserved Words
  1576. D Primitive Types
  1577. Notes
  1578. E Using the Debugger
  1579. Objectives
  1580. Outline
  1581. E.1 Introduction
  1582. E.2 Breakpoints and the run, stop, cont and print Commands
  1583. E.3 The print and set Commands
  1584. E.4 Controlling Execution Using the step, step up and next Commands
  1585. E.5 The watch Command
  1586. E.6 The clear Command
  1587. E.7 Wrap-Up
  1588. Appendices on the Web
  1589. Index
  1590. Symbols
  1591. Numerics
  1592. A
  1593. B
  1594. C
  1595. D
  1596. E
  1597. F
  1598. G
  1599. H
  1600. I
  1601. J
  1602. K
  1603. L
  1604. M
  1605. N
  1606. O
  1607. P
  1608. Q
  1609. R
  1610. S
  1611. T
  1612. U
  1613. V
  1614. W
  1615. X
  1616. Y
  1617. Z
  1618. ADDITIONAL COMMENTS FROM RECENT EDITIONS REVIEWERS
  1619. 26 Swing GUI Components: Part 1
  1620. Objectives
  1621. Outline
  1622. 26.1 Introduction
  1623. 26.2 Java’s Nimbus Look-and-Feel
  1624. 26.3 Simple GUI-Based Input/Output with JOptionPane
  1625. 26.4 Overview of Swing Components
  1626. 26.5 Displaying Text and Images in a Window
  1627. 26.6 Text Fields and an Introduction to Event Handling with Nested Classes
  1628. 26.7 Common GUI Event Types and Listener Interfaces
  1629. 26.8 How Event Handling Works
  1630. 26.9 JButton
  1631. 26.10 Buttons That Maintain State
  1632. 26.10.1 JCheckBox
  1633. Relationship Between an Inner Class and Its Top-Level Class
  1634. 26.10.2 JRadioButton
  1635. 26.11 JComboBox; Using an Anonymous Inner Class for Event Handling
  1636. 26.12 JList
  1637. 26.13 Multiple-Selection Lists
  1638. 26.14 Mouse Event Handling
  1639. 26.15 Adapter Classes
  1640. 26.16 JPanel Subclass for Drawing with the Mouse
  1641. 26.17 Key Event Handling
  1642. 26.18 Introduction to Layout Managers
  1643. 26.18.1 FlowLayout
  1644. 26.18.2 BorderLayout
  1645. 26.18.3 GridLayout
  1646. 26.19 Using Panels to Manage More Complex Layouts
  1647. 26.20 JTextArea
  1648. 26.21 Wrap-Up
  1649. Summary
  1650. Section 26.1 Introduction
  1651. Section 26.2 Java’s Nimbus Look-and-Feel
  1652. Section 26.3 Simple GUI-Based Input/Output with JOptionPane
  1653. Section 26.4 Overview of Swing Components
  1654. Section 26.5 Displaying Text and Images in a Window
  1655. Section 26.6 Text Fields and an Introduction to Event Handling with Nested Classes
  1656. Section 26.7 Common GUI Event Types and Listener Interfaces
  1657. Section 26.8 How Event Handling Works
  1658. Section 26.9 JButton
  1659. Section 26.10 Buttons That Maintain State
  1660. Section 26.11 JComboBox; Using an Anonymous Inner Class for Event Handling
  1661. Section 26.12 JList
  1662. Section 26.13 Multiple-Selection Lists
  1663. Section 26.14 Mouse Event Handling
  1664. Section 26.15 Adapter Classes
  1665. Section 26.16 JPanel Subclass for Drawing with the Mouse
  1666. Section 26.17 Key Event Handling
  1667. Section 26.18 Introduction to Layout Managers
  1668. Section 26.19 Using Panels to Manage More Complex Layouts
  1669. Section 26.20 JTextArea
  1670. Self-Review Exercises
  1671. Answers to Self-Review Exercises
  1672. Exercises
  1673. (Optional) GUI and Graphics Case Study Exercise: Expanding the Interface
  1674. Making a Difference
  1675. 27 Graphics and Java 2D
  1676. Objectives
  1677. Outline
  1678. 27.1 Introduction
  1679. 27.2 Graphics Contexts and Graphics Objects
  1680. 27.3 Color Control
  1681. 27.4 Manipulating Fonts
  1682. 27.5 Drawing Lines, Rectangles and Ovals
  1683. 27.6 Drawing Arcs
  1684. 27.7 Drawing Polygons and Polylines
  1685. 27.8 Java 2D API
  1686. 27.9 Wrap-Up
  1687. Summary
  1688. Section 27.1 Introduction
  1689. Section 27.2 Graphics Contexts and Graphics Objects
  1690. Section 27.3 Color Control
  1691. Section 27.4 Manipulating Fonts
  1692. Section 27.5 Drawing Lines, Rectangles and Ovals
  1693. Section 27.6 Drawing Arcs
  1694. Section 27.7 Drawing Polygons and Polylines
  1695. Section 27.8 Java 2D API
  1696. Self-Review Exercises
  1697. Answers to Self-Review Exercises
  1698. Exercises
  1699. (Optional) GUI and Graphics Case Study Exercise: Adding Java 2D
  1700. Making a Difference
  1701. 28 Networking
  1702. Objectives
  1703. Outline
  1704. 28.1 Introduction1
  1705. 28.2 Reading a File on a Web Server
  1706. 28.3 Establishing a Simple Server Using Stream Sockets
  1707. 28.4 Establishing a Simple Client Using Stream Sockets
  1708. 28.5 Client/Server Interaction with Stream Socket Connections
  1709. 28.6 Datagrams: Connectionless Client/Server Interaction
  1710. 28.7 Client/Server Tic-Tac-Toe Using a Multithreaded Server
  1711. 28.8 Optional Online Case Study: DeitelMessenger2
  1712. 28.9 Wrap-Up
  1713. Summary
  1714. Section 28.1 Introduction
  1715. Section 28.2 Reading a File on a Web Server
  1716. Section 28.3 Establishing a Simple Server Using Stream Sockets
  1717. Section 28.4 Establishing a Simple Client Using Stream Sockets
  1718. Section 28.6 Datagrams: Connectionless Client/Server Interaction
  1719. Self-Review Exercises
  1720. Answers to Self-Review Exercises
  1721. Exercises
  1722. 29 Java Persistence API (JPA)
  1723. Objectives
  1724. Outline
  1725. 29.1 Introduction
  1726. 29.2 JPA Technology Overview
  1727. 29.2.1 Generated Entity Classes
  1728. 29.2.2 Relationships Between Tables in the Entity Classes
  1729. 29.2.3 The javax.persistence Package
  1730. EntityManager Interface
  1731. EntityManagerFactory Interface and the Persistence Class
  1732. TypedQuery Class, Dynamic Queries and Named Queries
  1733. 29.3 Querying a Database with JPA
  1734. 29.3.1 Creating the Java DB Database
  1735. Creating the Database
  1736. 29.3.2 Populating the books Database with Sample Data
  1737. 29.3.3 Creating the Java Project
  1738. 29.3.4 Adding the JPA and Java DB Libraries
  1739. EclipseLink—The JPA Reference Implementation
  1740. Adding Libraries
  1741. 29.3.5 Creating the Persistence Unit for the books Database
  1742. 29.3.6 Querying the Authors Table
  1743. Importing the JPA Interfaces and Class Used in This Example
  1744. Creating the EntityManagerFactory Object
  1745. Creating the EntityManager
  1746. Creating a TypedQuery That Retrieves the Authors Table
  1747. Displaying the Query Results
  1748. 29.3.7 JPA Features of Autogenerated Class Authors
  1749. JPA Annotations for Class Authors
  1750. JPA Annotations for Class Authors’ Instance Variables
  1751. 29.4 Named Queries; Accessing Data from Multiple Tables
  1752. 29.4.1 Using a Named Query to Get the List of Authors, then Display the Authors with Their Titles
  1753. Creating a TypedQuery That Retrieves the Authors Table
  1754. Processing the Results
  1755. 29.4.2 Using a Named Query to Get the List of Titles, then Display Each with Its Authors
  1756. 29.5 Address Book: Using JPA and Transactions to Modify a Database
  1757. 29.5.1 Transaction Processing
  1758. 29.5.2 Creating the AddressBook Database, Project and Persistence Unit
  1759. Step 1: Creating the addressbook Database
  1760. Step 2: Populating the Database
  1761. Step 3: Creating the AddressBook Project
  1762. Step 4: Adding the JPA and Java DB Libraries
  1763. Step 5: Creating the AddressBook Database’s Persistence Unit
  1764. 29.5.3 Addresses Entity Class
  1765. Ordering the Named Query Results
  1766. ToString Method of Class Addresses
  1767. 29.5.4 AddressBookController Class
  1768. Obtaining the EntityManager
  1769. Obtaining the Complete List of Contacts—Method getAllEntries
  1770. Adding an Entry to the Database—Method addEntryButtonPressed
  1771. Finding by Last Name—Method findButtonPressed
  1772. 29.5.5 Other JPA Operations
  1773. Updating an Existing Entity
  1774. Deleting an Existing Entity
  1775. 29.6 Web Resources
  1776. 29.7 Wrap-Up
  1777. 30 JavaServer™ Faces Web Apps: Part 1
  1778. Objectives
  1779. Outline
  1780. 30.1 Introduction
  1781. 30.2 HyperText Transfer Protocol (HTTP) Transactions
  1782. 30.3 Multitier Application Architecture
  1783. 30.4 Your First JSF Web App
  1784. 30.4.1 The Default index.xhtml Document: Introducing Facelets
  1785. Facelets: XHTML and JSF Markup
  1786. XML Declaration, Comments and the DOCTYPE Declaration
  1787. Specifying the XML Namespaces Used in the Document
  1788. The h:head and h:body Elements
  1789. 30.4.2 Examining the WebTimeBean Class
  1790. JavaBeans
  1791. Class WebTimeBean
  1792. The @ManagedBean Annotation
  1793. Processing the EL Expression
  1794. 30.4.3 Building the WebTime JSF Web App in NetBeans
  1795. Creating the JSF Web Application Project
  1796. Examining the NetBeans Projects Window
  1797. Examining the Default index.xhtml Page
  1798. Editing the h:head Element’s Contents
  1799. Editing the h:body Element’s Contents
  1800. Defining the Page’s Logic: Class WebTimeBean
  1801. Adding the EL Expression to the index.xhtml Page
  1802. Running the Application
  1803. Debugging the Application
  1804. Testing the Application from Other Web Browsers
  1805. 30.5 Model-View-Controller Architecture of JSF Apps
  1806. 30.6 Common JSF Components
  1807. 30.7 Validation Using JSF Standard Validators
  1808. 30.8 Session Tracking
  1809. 30.8.1 Cookies
  1810. 30.8.2 Session Tracking with @SessionScoped Beans
  1811. Test-Driving the App
  1812. @SessionScoped Class SelectionsBean
  1813. Methods of Class SelectionsBean
  1814. index.xhtml
  1815. recommendations.xhtml
  1816. Iterating Through the List of Books
  1817. 30.9 Wrap-Up
  1818. Summary
  1819. Section 30.1 Introduction
  1820. Section 30.2 HyperText Transfer Protocol (HTTP) Transactions
  1821. Section 30.3 Multitier Application Architecture
  1822. Section 30.4 Your First JSF Web App
  1823. Section 30.4.1 The Default index.xhtml Document: Introducing Facelets
  1824. Section 30.4.2 Examining the WebTimeBean Class
  1825. Section 30.5 Model-View-Controller Architecture of JSF Apps
  1826. Section 30.6 Common JSF Components
  1827. Section 30.7 Validation Using JSF Standard Validators
  1828. Section 30.8 Session Tracking
  1829. Section 30.8.1 Cookies
  1830. Section 30.8.2 Session Tracking with @SessionScoped Beans
  1831. Self-Review Exercises
  1832. Answers to Self-Review Exercises
  1833. Exercises
  1834. 31 JavaServer™ Faces Web Apps: Part 2
  1835. Objectives
  1836. Outline
  1837. 31.1 Introduction
  1838. 31.2 Accessing Databases in Web Apps
  1839. 31.2.1 Setting Up the Database
  1840. Open NetBeans and Ensure that Java DB and GlassFish Are Running
  1841. Creating the Database
  1842. Populate the addressbook Database with Sample Data
  1843. 31.2.2 Class AddressBean
  1844. Defining a Data Source with the Annotation @DataSourceDefinition
  1845. Class AddressBean’s Annotations—@Named and @javax.faces.view.ViewScoped
  1846. Injecting the DataSource into Class AddressBean
  1847. AddressBean Method getAddresses
  1848. AddressBean Method save
  1849. 31.2.3 index.xhtml Facelets Page
  1850. The h:dataTable Element
  1851. The h:column Elements
  1852. 31.2.4 addentry.xhtml Facelets Page
  1853. 31.3 Ajax
  1854. 31.4 Adding Ajax Functionality to the Validation App
  1855. 31.5 Wrap-Up
  1856. Summary
  1857. Section 30.2.2 Class AddressBean
  1858. Section 30.2.3 index.xhtml Facelets Page
  1859. Section 30.2.4 addentry.xhtml Facelets Page
  1860. Section 31.3 Ajax
  1861. Section 31.4 Adding Ajax Functionality to the Validation App
  1862. Self-Review Exercise
  1863. Answers to Self-Review Exercise
  1864. Exercises
  1865. 32 REST Web Services
  1866. Objectives
  1867. Outline
  1868. 32.1 Introduction
  1869. 32.2 Web Service Basics
  1870. 32.3 Simple Object Access Protocol (SOAP)
  1871. 32.4 Representational State Transfer (REST)
  1872. 32.5 JavaScript Object Notation (JSON)
  1873. 32.6 Publishing and Consuming SOAP-Based Web Services
  1874. 32.6.1 Creating a Web Application Project and Adding a Web Service Class in NetBeans
  1875. Creating a Web Application Project in NetBeans
  1876. Adding a Web Service Class to a Web Application Project
  1877. 32.6.2 Defining the WelcomeSOAP Web Service in NetBeans
  1878. Annotation import Declarations
  1879. @WebService Annotation
  1880. WelcomeSOAP Service’s welcome Method
  1881. Completing the Web Service’s Code
  1882. 32.6.3 Publishing the WelcomeSOAP Web Service from NetBeans
  1883. 32.6.4 Testing the WelcomeSOAP Web Service with GlassFish Application Server’s Tester Web Page
  1884. Application Server Note
  1885. Testing the WelcomeSOAP Web Service from Another Computer
  1886. 32.6.5 Describing a Web Service with the Web Service Description Language (WSDL)
  1887. Accessing the WelcomeSOAP Web Service’s WSDL from Another Computer
  1888. 32.6.6 Creating a Client to Consume the WelcomeSOAP Web Service
  1889. Service Endpoint Interface (SEI)
  1890. Creating a Desktop Application Project in NetBeans
  1891. Step 2: Adding a Web Service Reference to an Application
  1892. 32.6.7 Consuming the WelcomeSOAP Web Service
  1893. 32.7 Publishing and Consuming REST-Based XML Web Services
  1894. 32.7.1 Creating a REST-Based XML Web Service
  1895. Testing the RESTful Web Service
  1896. WADL
  1897. 32.7.2 Consuming a REST-Based XML Web Service
  1898. 32.8 Publishing and Consuming REST-Based JSON Web Services
  1899. 32.8.1 Creating a REST-Based JSON Web Service
  1900. 32.8.2 Consuming a REST-Based JSON Web Service
  1901. 32.9 Session Tracking in a SOAP Web Service
  1902. 32.9.1 Creating a Blackjack Web Service
  1903. Session Tracking in Web Services: @HttpSessionScope Annotation
  1904. Client Interactions with the Blackjack Web Service
  1905. 32.9.2 Consuming the Blackjack Web Service
  1906. Configuring the Client for Session Tracking
  1907. Method gameOver
  1908. Method dealJButtonActionPerformed
  1909. Method hitJButtonActionPerformed
  1910. Method dealerPlay
  1911. Method standJButtonActionPerformed
  1912. Method displayCard
  1913. 32.10 Consuming a Database-Driven SOAP Web Service
  1914. 32.10.1 Creating the Reservation Database
  1915. Creating the Reservation Web Service
  1916. 32.10.2 Creating a Web Application to Interact with the Reservation Service
  1917. index.xhtml
  1918. ReservationBean.java
  1919. 32.11 Equation Generator: Returning User-Defined Types
  1920. 32.11.1 Creating the EquationGeneratorXML Web Service
  1921. 32.11.2 Consuming the EquationGeneratorXML Web Service
  1922. 32.11.3 Creating the EquationGeneratorJSON Web Service
  1923. 32.11.4 Consuming the EquationGeneratorJSON Web Service
  1924. 32.12 Wrap-Up
  1925. Summary
  1926. Section 32.1 Introduction
  1927. Section 32.2 Web Service Basics
  1928. Section 32.3 Simple Object Access Protocol (SOAP)
  1929. Section 32.4 Representational State Transfer (REST)
  1930. Section 32.5 JavaScript Object Notation (JSON)
  1931. Section 32.6.1 Creating a Web Application Project and Adding a Web Service Class in NetBeans
  1932. Section 31.6.2 Defining the WelcomeSOAP Web Service in NetBeans
  1933. Section 31.6.3 Publishing the WelcomeSOAP Web Service from NetBeans
  1934. Section 31.6.4 Testing the WelcomeSOAP Web Service with GlassFish Application Server’s Tester Web Page
  1935. Section 32.6.5 Describing a Web Service with the Web Service Description Language (WSDL)
  1936. Section 31.6.6 Creating a Client to Consume the WelcomeSOAP Web Service
  1937. Section 31.6.7 Consuming the WelcomeSOAP Web Service
  1938. Section 32.7.1 Creating a REST-Based XML Web Service
  1939. Section 32.7.2 Consuming a REST-Based XML Web Service
  1940. Section 32.8 Publishing and Consuming REST-Based JSON Web Services
  1941. Section 32.8.1 Creating a REST-Based JSON Web Service
  1942. Section 32.8.2 Consuming a REST-Based JSON Web Service
  1943. Section 32.9 Session Tracking in a SOAP Web Service
  1944. Section 31.9.1 Creating a Blackjack Web Service
  1945. Section 31.9.2 Consuming the Blackjack Web Service
  1946. Section 32.11 Equation Generator: Returning User-Defined Types
  1947. Self-Review Exercises
  1948. Answers to Self-Review Exercises
  1949. Exercises
  1950. Making a Difference
  1951. 33 ATM Case Study, Part 1: Object-Oriented Design with the UML
  1952. Objectives
  1953. Outline
  1954. 33.1 Case Study Introduction
  1955. 33.2 Examining the Requirements Document
  1956. Self-Review Exercises for Section 33.2
  1957. 33.3 Identifying the Classes in a Requirements Document
  1958. Self-Review Exercises for Section 33.3
  1959. 33.4 Identifying Class Attributes
  1960. Self-Review Exercises for Section 33.4
  1961. 33.5 Identifying Objects’ States and Activities
  1962. Self-Review Exercises for Section 33.5
  1963. 33.6 Identifying Class Operations
  1964. Self-Review Exercises for Section 33.6
  1965. 33.7 Indicating Collaboration Among Objects
  1966. Self-Review Exercises for Section 33.7
  1967. 33.8 Wrap-Up
  1968. Answers to Self-Review Exercises
  1969. 34 ATM Case Study Part 2: Implementing the Design
  1970. Objectives
  1971. Outline
  1972. 34.1 Introduction
  1973. 34.2 Starting to Program the Classes of the ATM System
  1974. Self-Review Exercises for Section 34.2
  1975. 34.3 Incorporating Inheritance and Polymorphism into the ATM System
  1976. Self-Review Exercises for Section 34.3
  1977. 34.4 ATM Case Study Implementation
  1978. 34.4.1 Class ATM
  1979. ATM Method run
  1980. Authenticating a User
  1981. Performing Transactions
  1982. Creating a Transaction
  1983. Exiting the Main Menu and Processing Invalid Selections
  1984. Awaiting the Next ATM User
  1985. 34.4.2 Class Screen
  1986. 34.4.3 Class Keypad
  1987. 34.4.4 Class CashDispenser
  1988. 34.4.5 Class DepositSlot
  1989. 34.4.6 Class Account
  1990. 34.4.7 Class BankDatabase
  1991. 34.4.8 Class Transaction
  1992. 34.4.9 Class BalanceInquiry
  1993. 34.4.10 Class Withdrawal
  1994. 34.4.11 Class Deposit
  1995. 34.4.12 Class ATMCaseStudy
  1996. 34.5 Wrap-Up
  1997. Answers to Self-Review Exercises
  1998. 35 Swing GUI Components: Part 2
  1999. Objectives
  2000. Outline
  2001. 35.1 Introduction
  2002. Java SE 8: Implementing Event Listeners with Lambdas
  2003. 35.2 JSlider
  2004. 35.3 Understanding Windows in Java
  2005. Returning Window Resources to the System
  2006. Displaying and Positioning Windows
  2007. Window Events
  2008. 35.4 Using Menus with Frames
  2009. Overview of Several Menu-Related Components
  2010. Using Menus in an Application
  2011. Setting Up the File Menu
  2012. Setting Up the Format Menu
  2013. Creating the Rest of the GUI and Defining the Event Handlers
  2014. 35.5 JPopupMenu
  2015. 35.6 Pluggable Look-and-Feel
  2016. 35.7 JDesktopPane and JInternalFrame
  2017. 35.8 JTabbedPane
  2018. 35.9 BoxLayout Layout Manager
  2019. Creating Box Containers
  2020. Struts
  2021. Glue
  2022. Rigid Areas
  2023. Setting a BoxLayout for a Container
  2024. Adding Glue and JButtons
  2025. Creating the JTabbedPane
  2026. Attaching the Box Containers and JPanel to the JTabbedPane
  2027. 35.10 GridBagLayout Layout Manager
  2028. GridBagConstraints fields.
  2029. GridBagConstraints Field anchor
  2030. GridBagConstraints Field fill
  2031. GridBagConstraints Fields gridx and gridy
  2032. GridBagConstraints Field gridwidth
  2033. GridBagConstraints Field weightx
  2034. GridBagConstraints Field weighty
  2035. Effects of weightx and weighty
  2036. Demonstrating GridBagLayout
  2037. GUI Overview
  2038. JTextArea textArea1
  2039. JButton button1
  2040. JComboBox comboBox
  2041. JButton button2
  2042. JButton button3
  2043. JTextField textField and JTextArea textArea2
  2044. Method addComponent
  2045. GridBagConstraints Constants RELATIVE and REMAINDER
  2046. Setting the JFrame’s Layout to a GridBagLayout
  2047. Configuring the JTextField
  2048. Configuring JButton buttons[0]
  2049. Configuring JButton buttons[1]
  2050. Configuring JButton buttons[2]
  2051. Configuring JComboBox
  2052. Configuring JButton buttons[3]
  2053. Configuring JButton buttons[4]
  2054. Configuring JList
  2055. 35.11 Wrap-Up
  2056. Summary
  2057. Section 22.2 JSlider
  2058. Section 35.3 Understanding Windows in Java
  2059. Section 35.4 Using Menus with Frames
  2060. Section 22.5 JPopupMenu
  2061. Section 35.6 Pluggable Look-and-Feel
  2062. Section 22.7 JDesktopPane and JInternalFrame
  2063. Section 22.8 JTabbedPane
  2064. Section 22.9 BoxLayout Layout Manager
  2065. Section 22.10 GridBagLayout Layout Manager
  2066. Self-Review Exercises
  2067. Answers to Self-Review Exercises
  2068. Exercises
  2069. 36 Java Platform Module System
  2070. Objectives
  2071. Outline
  2072. 36.1 Introduction1
  2073. 36.2 Module Declarations
  2074. 36.2.1 requires
  2075. 36.2.2 requires transitive—Implied Readability
  2076. 36.2.3 exports and exports…to
  2077. 36.2.4 uses
  2078. 36.2.5 provides…with
  2079. 36.2.6 open, opens and opens…to10,11
  2080. Allowing Runtime-Only Access to a Package
  2081. Allowing Runtime-Only Access to a Package By Specific Modules
  2082. Allowing Runtime-Only Access to All Packages in a Module
  2083. Reflection Defaults
  2084. Dependency Injection
  2085. 36.2.7 Restricted Keywords
  2086. 36.3 Modularized Welcome App
  2087. 36.3.1 Welcome App’s Structure
  2088. Module Naming Conventions
  2089. Listing the java.base Module’s Contents
  2090. 36.3.2 Class Welcome
  2091. 36.3.3 module-info.java
  2092. 36.3.4 Module-Dependency Graph
  2093. 36.3.5 Compiling a Module
  2094. Note Regarding Lengthy Commands in This Chapter
  2095. Welcome App’s Folder Structure After Compilation
  2096. Listing the com.deitel.welcome Module’s Contents
  2097. 36.3.6 Running an App from a Module’s Exploded Folders
  2098. 36.3.7 Packaging a Module into a Modular JAR File
  2099. 36.3.8 Running the Welcome App from a Modular JAR File
  2100. 36.3.9 Aside: Classpath vs. Module Path
  2101. 36.4 Creating and Using a Custom Module
  2102. 36.4.1 Exporting a Package for Use in Other Modules
  2103. com.deitel.timelibrary Module Declaration
  2104. 36.4.2 Using a Class from a Package in Another Module
  2105. com.deitel.timetest Module Declaration
  2106. com.deitel.timetest Module-dependency Graph
  2107. 36.4.3 Compiling and Running the Example
  2108. Compiling Module com.deitel.timelibrary
  2109. Compiling Module com.deitel.timetest
  2110. Running the Example
  2111. 36.4.4 Packaging the App into Modular JAR Files
  2112. Running the App from a Modular JAR File
  2113. 36.4.5 Strong Encapsulation and Accessibility
  2114. Compilation Error When Attempting to Use an Inaccessible Type
  2115. 36.5 Module-Dependency Graphs: A Deeper Look
  2116. 36.5.1 java.sql
  2117. 36.5.2 java.se
  2118. 36.5.3 Browsing the JDK Module Graph
  2119. 36.5.4 Error: Module Graph with a Cycle
  2120. A Module That (Incorrectly) Requires Itself
  2121. Two Modules That (Incorrectly) Require One Another
  2122. Modules in a Cycle Are Really “One Thing”
  2123. 36.6 Migrating Code to Java 9
  2124. 36.6.1 Unnamed Module
  2125. 36.6.2 Automatic Modules
  2126. 36.6.3 jdeps: Java Dependency Analysis
  2127. Determining the Modules You Need
  2128. Verbose jdeps Output
  2129. Using jdeps to Produce DOT Files for Graphing Tools
  2130. Additional jdeps Options
  2131. 36.7 Resources in Modules; Using an Automatic Module
  2132. 36.7.1 Automatic Modules
  2133. Code Changes for Modularization
  2134. 36.7.2 Requiring Multiple Modules
  2135. 36.7.3 Opening a Module for Reflection
  2136. 36.7.4 Module-Dependency Graph
  2137. 36.7.5 Compiling the Module
  2138. Copying the Resource Files into the Module
  2139. 36.7.6 Running a Modularized App
  2140. 36.8 Creating Custom Runtimes with jlink
  2141. 36.8.1 Listing the JRE’s Modules
  2142. 36.8.2 Custom Runtime Containing Only java.base
  2143. Note Regarding the JAVA_HOME Variable
  2144. Executing the Welcome App Using This Custom Runtime
  2145. Listing the Modules in a Custom Runtime
  2146. 36.8.3 Creating a Custom Runtime for the Welcome App
  2147. 36.8.4 Executing the Welcome App Using a Custom Runtime
  2148. 36.8.5 Using the Module Resolver on a Custom Runtime
  2149. 36.9 Services and ServiceLoader
  2150. 36.9.1 Service-Provider Interface
  2151. 36.9.2 Loading and Consuming Service Providers
  2152. Using ServiceLoader to Locate Service Providers
  2153. Using a Service-Provider Interface
  2154. 36.9.3 uses Module Directive and Service Consumers
  2155. 36.9.4 Running the App with No Service Providers
  2156. 36.9.5 Implementing a Service Provider
  2157. 36.9.6 provides…with Module Directive and Declaring a Service Provider
  2158. 36.9.7 Running the App with One Service Provider
  2159. 36.9.8 Implementing a Second Service Provider
  2160. 36.9.9 Running the App with Two Service Providers
  2161. 36.10 Wrap-Up
  2162. 37 Additional Java 9 Topics
  2163. Objectives
  2164. Outline
  2165. 37.1 Introduction
  2166. 37.2 Recap: Java 9 Features Covered in Earlier Chapters
  2167. 37.3 New Version String Format
  2168. 37.4 Regular Expressions: New Matcher Class Methods
  2169. 37.4.1 Methods appendReplacement and appendTail
  2170. 37.4.2 Methods replaceFirst and replaceAll
  2171. 37.4.3 Method results
  2172. 37.5 New Stream Interface Methods
  2173. 37.5.1 Stream Methods takeWhile and dropWhile
  2174. 37.5.2 Stream Method iterate
  2175. 37.5.3 Stream Method ofNullable
  2176. 37.6 Modules in JShell
  2177. Adding a Module to the JShell Session
  2178. Importing a Class from a Module’s Exported Package(s)
  2179. Using the Imported Class
  2180. 37.7 JavaFX 9 Skin APIs
  2181. 37.8 Other GUI and Graphics Enhancements
  2182. 37.8.1 Multi-Resolution Images
  2183. 37.8.2 TIFF Image I/O
  2184. 37.8.3 Platform-Specific Desktop Features
  2185. 37.9 Security Related Java 9 Topics
  2186. 37.9.1 Filter Incoming Serialization Data
  2187. 37.9.2 Create PKCS12 Keystores by Default
  2188. 37.9.3 Datagram Transport Layer Security (DTLS)
  2189. 37.9.4 OCSP Stapling for TLS
  2190. 37.9.5 TLS Application-Layer Protocol Negotiation Extension
  2191. 37.10 Other Java 9 Topics
  2192. 37.10.1 Indify String Concatenation
  2193. 37.10.2 Platform Logging API and Service
  2194. 37.10.3 Process API Updates
  2195. 37.10.4 Spin-Wait Hints
  2196. 37.10.5 UTF-8 Property Resource Bundles
  2197. 37.10.6 Use CLDR Locale Data by Default
  2198. 37.10.7 Elide Deprecation Warnings on Import Statements
  2199. 37.10.8 Multi-Release JAR Files
  2200. 37.10.9 Unicode 8
  2201. 37.10.10 Concurrency Enhancements
  2202. New Methods of Class CompletableFuture
  2203. 37.11 Items Removed from the JDK and Java 9
  2204. Removed Platform Features
  2205. Removed Methods
  2206. 37.12 Items Proposed for Removal from Future Java Versions
  2207. 37.12.1 Enhanced Deprecation
  2208. 37.12.2 Items Likely to Be Removed in Future Java Versions
  2209. 37.12.3 Finding Deprecated Features
  2210. 37.12.4 Java Applets
  2211. 37.13 Wrap-Up
  2212. F Using the Java API Documentation
  2213. F.1 Introduction
  2214. F.2 Navigating the Java API
  2215. G Creating Documentation with javadoc
  2216. G.1 Introduction
  2217. G.2 Documentation Comments
  2218. G.3 Documenting Java Source Code
  2219. G.4 javadoc
  2220. Downloading the Java Documentation
  2221. Executing javadoc from the Command Line
  2222. G.5 Files Produced by javadoc
  2223. H Unicode®
  2224. H.1 Introduction
  2225. H.2 Unicode Transformation Formats
  2226. H.3 Characters and Glyphs
  2227. H.4 Advantages/Disadvantages of Unicode
  2228. H.5 Using Unicode
  2229. H.6 Character Ranges
  2230. I Formatted Output
  2231. Objectives
  2232. Outline
  2233. I.1 Introduction
  2234. I.2 Streams
  2235. I.3 Formatting Output with printf
  2236. I.4 Printing Integers
  2237. I.5 Printing Floating-Point Numbers
  2238. I.6 Printing Strings and Characters
  2239. I.7 Printing Dates and Times
  2240. I.8 Other Conversion Characters
  2241. I.9 Printing with Field Widths and Precisions
  2242. I.10 Using Flags in the printf Format String
  2243. I.11 Printing with Argument Indices
  2244. I.12 Printing Literals and Escape Sequences
  2245. I.13 Formatting Output with Class Formatter
  2246. I.14 Wrap-Up
  2247. J Number Systems
  2248. Objectives
  2249. Outline
  2250. J.1 Introduction
  2251. J.2 Abbreviating Binary Numbers as Octal and Hexadecimal Numbers
  2252. J.3 Converting Octal and Hexadecimal Numbers to Binary Numbers
  2253. J.4 Converting from Binary, Octal or Hexadecimal to Decimal
  2254. J.5 Converting from Decimal to Binary, Octal or Hexadecimal
  2255. J.6 Negative Binary Numbers: Two’s Complement Notation
  2256. K Bit Manipulation
  2257. K.1 Introduction
  2258. K.2 Bit Manipulation and the Bitwise Operators
  2259. K.3 BitSet Class
  2260. L Labeled break and continue Statements
  2261. L.1 Introduction
  2262. L.2 Labeled break Statement
  2263. L.3 Labeled continue Statement
  2264. M UML 2: Additional Diagram Types
  2265. M.1 Introduction
  2266. M.2 Additional Diagram Types
  2267. N Design Patterns
  2268. N.1 Introduction
  2269. History of Object-Oriented Design Patterns
  2270. N.2 Creational, Structural and Behavioral Design Patterns
  2271. N.2.1 Creational Design Patterns
  2272. Singleton
  2273. N.2.2 Structural Design Patterns
  2274. Proxy
  2275. N.2.3 Behavioral Design Patterns
  2276. Memento
  2277. State
  2278. N.2.4 Conclusion
  2279. N.3 Design Patterns in Packages java.awt and javax.swing
  2280. N.3.1 Creational Design Patterns
  2281. Factory Method
  2282. N.3.2 Structural Design Patterns
  2283. Adapter
  2284. Bridge
  2285. Composite
  2286. N.3.3 Behavioral Design Patterns
  2287. Chain of Responsibility
  2288. Command
  2289. Observer
  2290. Strategy
  2291. Template Method
  2292. N.3.4 Conclusion
  2293. N.4 Concurrency Design Patterns
  2294. Concurrency Design Patterns
  2295. N.5 Design Patterns Used in Packages java.io and java.net
  2296. N.5.1 Creational Design Patterns
  2297. Abstract Factory
  2298. N.5.2 Structural Design Patterns
  2299. Decorator
  2300. Facade
  2301. N.5.3 Architectural Patterns
  2302. MVC
  2303. Layers
  2304. N.5.4 Conclusion
  2305. N.6 Design Patterns Used in Package java.util
  2306. N.6.1 Creational Design Patterns
  2307. Prototype
  2308. N.6.2 Behavioral Design Patterns
  2309. Iterator
  2310. N.7 Wrap-Up