Home > Store

OCP Oracle Certified Professional Java SE 17 Developer (1Z0-829) Programmer's Guide

eBook

  • Your Price: $61.59
  • List Price: $76.99
  • Includes EPUB and PDF
  • About eBook Formats
  • This eBook includes the following formats, accessible from your Account page after purchase:

    ePub EPUB The open industry format known for its reflowable content and usability on supported mobile devices.

    Adobe Reader PDF The popular standard, used most often with the free Acrobat® Reader® software.

    This eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

Also available in other formats.

Register your product to gain access to bonus material or receive a coupon.

Description

  • Copyright 2023
  • Edition: 1st
  • eBook
  • ISBN-10: 0-13-799383-8
  • ISBN-13: 978-0-13-799383-3

A comprehensive guide to the Java programming language and the Java SE 11 and Java SE 17 Developer certification exams, this complete reference contains so much information, we had to split the print edition into two volumes for ease of use. This two-volume set features exhaustive coverage of all the Java language features and APIs covered by the exam objectives. Both volumes of this print edition are included in your purchase and are not sold separately.

OCP Oracle Certified Professional Java SE 17 Developer (Exam 1Z0-829) Programmer's Guide is a unique guide that combines a rigorous introduction to programming in Java with meticulous coverage of the Java SE 17 and Java SE 11 Developer exam objectives. Fully updated to reflect changes in the latest exams, it features an increased focus on analyzing code scenarios--not just individual language constructs. Each objective is thoroughly addressed, reflecting the latest features and APIs, as well as best practices for taking the exam. The only book anyone needs to study for Java SE 17 Developer or Java SE 11 Developer certification. Book features include:

  • Easy to find coverage of key topics relevant to each exam objective
  • An introduction to essential concepts in object-oriented programming (OOP) and functional-style programming
  • In-depth coverage of declarations, access control, operators, flow control, OOP techniques, lambda expressions, streams, modules, concurrency, Java I/O, key API classes and much more
  • Program output demonstrating expected results from complete Java programs
  • Unique diagrams to illustrate important concepts, such as Java I/O, modules, and streams
  • Extensive use of Unified Modeling Language (UML) to illustrate program design
  • Dozens of review questions with annotated answers to help prepare for the exam and a complete mock exam

Contents, Volume I (print):
Figures xxiii
Tables xxvii
Examples xxxi
Foreword xxxix
Preface xli
Chapter 1: Basics of Java Programming 1
Chapter 2: Basic Elements, Primitive Data Types, and Operators 29
Chapter 3: Declarations 97
Chapter 4: Control Flow 151
Chapter 5: Object-Oriented Programming 189
Chapter 6: Access Control 323
Chapter 7: Exception Handling 363
Chapter 8: Selected API Classes 423
Chapter 9: Nested Type Declarations 489
Chapter 10: Object Lifetime 531
Chapter 11: Generics 563
Chapter 12: Collections, Part I: ArrayList<E> 643
Chapter 13: Functional-Style Programming 673
Chapter 14: Object Comparison 741
Chapter 15: Collections: Part II 781
Index

Contents, Volume II (print):
Chapter 16: Streams 879
Chapter 17: Date and Time 1023
Chapter 18: Localization 1095
Chapter 19: Java Module System 1161
Chapter 20: Java I/O: Part I 1231
Chapter 21: Java I/O: Part II 1285
Chapter 22: Concurrency: Part I 1365
Chapter 23: Concurrency: Part II 1419
Chapter 24: Database Connectivity 1511
Chapter 25: Annotations 1555
Chapter 26: Secure Coding 1599
Appendix A: Taking the Java SE 17 and Java SE 11 Developer Exams 1615
Appendix B: Exam Topics: Java SE 17 Developer 1623
Appendix C: Exam Topics: Java SE 11 Developer 1629
Appendix D: Annotated Answers to Review Questions 1635
Appendix E: Mock Exam: Java SE 17 Developer 1709
Appendix F: Annotated Answers to Mock Exam 1737
Appendix G: Java Logging API Overview 1747
Index 1753

Register your book for convenient access to downloads, updates, and/or corrections as they become available. See inside book for details.

Extras

Author's Site

Visit the author's site at https://www.mughal.no/jse17ocp/.

Sample Content

Table of Contents

Volume I (print):

Note to Reader viii
Figures xxiii
Tables xxvii
Examples xxxi
Foreword xxxix
Preface xli

Chapter 1: Basics of Java Programming 1
1.1 The Java Ecosystem 2
1.2 Classes 5
1.3 Objects 8
1.4 Instance Members 9
1.5 Static Members 10
1.6 Inheritance 13
1.7 Aggregation 16
Review Questions 17
1.8 Sample Java Program 19
1.9 Program Output 24
Review Questions 26

Chapter 2: Basic Elements, Primitive Data Types, and Operators 29
2.1 Basic Language Elements 30
2.2 Primitive Data Types 41
2.3 Conversions 43
2.4 Type Conversion Contexts 46
2.5 Precedence and Associativity Rules for Operators 50
2.6 Evaluation Order of Operands 52
2.7 The Simple Assignment Operator = 54
2.8 Arithmetic Operators: *, /, %, +, - 58
2.9 The Binary String Concatenation Operator + 67
2.10 Variable Increment and Decrement Operators: ++, -- 69
Review Questions 71
2.11 Boolean Expressions 74
2.12 Relational Operators: <, <=, >, >= 74
2.13 Equality 75
2.14 Boolean Logical Operators: !, ^, &, | 78
2.15 Conditional Operators: &&, || 80
2.16 Integer Bitwise Operators: ~, &, |, ^ 82
2.17 Shift Operators: <<, >>, >>> 86
2.18 The Conditional Operator ?: 90
2.19 Other Operators: new, [], instanceof, -> 92
Review Questions 93

Chapter 3: Declarations 97
3.1 Class Declarations 99
3.2 Method Declarations 100
3.3 Statements 101
3.4 Variable Declarations 102
3.5 Instance Methods and the Object Reference this 106
3.6 Method Overloading 108
3.7 Constructors 109
3.8 Static Member Declarations 112
Review Questions 115
3.9 Arrays 117
3.10 Parameter Passing 127
3.11 Variable Arity Methods 136
3.12 The main() Method 141
3.13 Local Variable Type Inference 142
Review Questions 147

Chapter 4: Control Flow 151
4.1 Selection Statements 152
4.2 The switch Statement 155
4.3 The switch Expression 164
Review Questions 170
4.4 Iteration Statements 172
4.5 The while Statement 172
4.6 The do-while Statement 173
4.7 The for(;;) Statement 174
4.8 The for(:) Statement 176
4.9 Transfer Statements 179
4.10 Labeled Statements 179
4.11 The break Statement 180
4.12 The continue Statement 182
4.13 The return Statement 184
Review Questions 185

Chapter 5: Object-Oriented Programming 189
5.1 Implementing Inheritance 191
5.2 The Object Reference super 206
5.3 Chaining Constructors Using this() and super() 209
Review Questions 215
5.4 Abstract Classes and Methods 218
5.5 Final Declarations 225
Review Questions 234
5.6 Interfaces 237
Review Questions 257
5.7 Arrays and Subtyping 259
5.8 Reference Values and Conversions 261
5.9 Reference Value Assignment Conversions 261
5.10 Method Invocation Conversions Involving References 265
5.11 Reference Casting and the instanceof Operator 269
5.12 Polymorphism 278
Review Questions 283
5.13 Enum Types 287
5.14 Record Classes 299
5.15 Sealed Classes and Interfaces 311
Review Questions 318

Chapter 6: Access Control 323
6.1 Design Principle: Encapsulation 324
6.2 Java Source File Structure 325
6.3 Packages 326
6.4 Searching for Classes on the Class Path 337
Review Questions 341
6.5 Access Modifiers 345
6.6 Scope Rules 352
6.7 Implementing Immutability 356
Review Questions 360

Chapter 7: Exception Handling 363
7.1 Stack-Based Execution and Exception Propagation 365
7.2 Exception Types 368
7.3 Exception Handling: try, catch, and finally 375
7.4 The throw Statement 386
7.5 The throws Clause 388
Review Questions 392
7.6 The Multi-catch Clause 397
7.7 The try-with-resources Statement 407
7.8 Advantages of Exception Handling 416
Review Questions 417

Chapter 8: Selected API Classes 423
8.1 Overview of the java.lang Package 425
8.2 The Object Class 425
8.3 The Wrapper Classes 429
Review Questions 438
8.4 The String Class 439
8.5 The StringBuilder Class 464
Review Questions 471
8.6 The Math Class 478
8.7 The Random Class 482
8.8 Using Big Numbers 484
Review Questions 487

Chapter 9: Nested Type Declarations 489
9.1 Overview of Nested Type Declarations 491
9.2 Static Member Types 495
9.3 Non-Static Member Classes 501
Review Questions 510
9.4 Local Classes 512
9.5 Static Local Types 519
9.6 Anonymous Classes 521
Review Questions 527

Chapter 10: Object Lifetime 531
10.1 Garbage Collection 533
10.2 Reachable Objects 533
10.3 Facilitating Garbage Collection 536
10.4 Invoking Garbage Collection Programmatically 537
Review Questions 538
10.5 Initializers 540
10.6 Field Initializer Expressions 540
10.7 Static Initializer Blocks 545
10.8 Instance Initializer Blocks 551
10.9 Constructing Initial Object State 555
Review Questions 558

Chapter 11: Generics 563
11.1 Introducing Generics 565
11.2 Generic Types and Parameterized Types 567
11.3 Collections and Generics 578
11.4 Wildcards 579
11.5 Using References of Wildcard Parameterized Types 584
11.6 Bounded Type Parameters 591
11.7 Generic Methods and Constructors 593
11.8 Implementing a Simplified Generic Stack 598
Review Questions 600
11.9 Wildcard Capture 604
11.10 Flexibility with Wildcard Parameterized Types 607
11.11 Type Erasure 613
11.12 Implications for Overloading and Overriding 615
11.13 Limitations and Restrictions on Generic Types 623
Review Questions 636

Chapter 12: Collections, Part I: ArrayList<E> 643
12.1 Lists 644
12.2 Declaring References and Constructing ArrayLists 646
12.3 Modifying an ArrayList<E> 651
12.4 Querying an ArrayList<E> 655
12.5 Iterating Over an ArrayList<E> 657
12.6 Converting an ArrayList<E> to an Array 658
12.7 Creating List Views 659
12.8 Arrays versus ArrayLists 662
Review Questions 667

Chapter 13: Functional-Style Programming 673
13.1 Functional Interfaces 675
13.2 Lambda Expressions 679
13.3 Lambda Expressions and Anonymous Classes 688
Review Questions 693
13.4 Overview of Built-In Functional Interfaces 695
13.5 Suppliers 699
13.6 Predicates 703
13.7 Consumers 709
13.8 Functions 712
13.9 Two-Arity Specialization of Function<T, R>: BiFunction<T, U, R> 717
13.10 Extending Function<T,T>: UnaryOperator<T> 720
13.11 Extending BiFunction<T,T,T>: BinaryOperator<T> 721
13.12 Currying Functions 723
13.13 Method and Constructor References 724
13.14 Contexts for Defining Lambda Expressions 733
Review Questions 735

Chapter 14: Object Comparison 741
14.1 The Objects Class 743
14.2 Implementing the equals() Method 744
14.3 Implementing the hashCode() Method 753
14.4 Implementing the java.lang.Comparable<E> Interface 761
14.5 Implementing the java.util.Comparator<E> Interface 769
Review Questions 774

Chapter 15: Collections: Part II 781
15.1 The Java Collections Framework 783
15.2 Collections 790
15.3 Lists 801
15.4 Sets 804
15.5 Sorted Sets and Navigable Sets 810
15.6 Queues 814
15.7 Deques 821
Review Questions 826
15.8 Maps 830
15.9 Map Implementations 840
15.10 Sorted Maps and Navigable Maps 845
Review Questions 851
15.11 The Collections Class 856
15.12 The Arrays Class 864
Review Questions 874

Index

Volume II (print):

Note to Reader vi

Chapter 16: Streams 879
16.1 Introduction to Streams 881
16.2 Running Example: The CD Record Class 882
16.3 Stream Basics 884
16.4 Building Streams 890
16.5 Intermediate Stream Operations 905
16.6 The Optional Class 940
16.7 Terminal Stream Operations 946
16.8 Collectors 978
16.9 Parallel Streams 1009
Review Questions 1016

Chapter 17: Date and Time 1023
17.1 Date and Time API Overview 1024
17.2 Working with Dates and Times 1027
17.3 Using Temporal Units and Temporal Fields 1044
17.4 Working with Instants 1049
17.5 Working with Periods 1057
17.6 Working with Durations 1064
17.7 Working with Time Zones and Daylight Savings 1072
17.8 Converting Date and Time Values to Legacy Date 1088
Review Questions 1089

Chapter 18: Localization 1095
18.1 Using Locales 1096
18.2 Properties Files 1100
18.3 Bundling Resources 1102
Review Questions 1112
18.4 Core API for Formatting and Parsing of Values 1115
18.5 Formatting and Parsing Number, Currency, and Percentage Values 1116
18.6 Formatting and Parsing Date and Time 1127
18.7 Formatting and Parsing Messages 1139
Review Questions 1153

Chapter 19: Java Module System 1161
19.1 Making the Case for Modules 1163
19.2 The Modular JDK 1164
19.3 Module Basics 1168
19.4 Overview of Module Directives 1177
19.5 Creating a Modular Application 1179
19.6 Compiling and Running a Modular Application 1186
19.7 Creating JAR Files 1189
19.8 Open Modules and the opens Directive 1191
19.9 Services 1196
19.10 Creating Runtime Images 1204
19.11 Categories of Modules 1205
19.12 Migrating to Modules 1209
19.13 Exploring Modules 1211
19.14 Summary of Selected Operations with the JDK Tools 1218
Review Questions 1223

Chapter 20: Java I/O: Part I 1231
20.1 Input and Output 1233
20.2 Byte Streams: Input Streams and Output Streams 1234
20.3 Character Streams: Readers and Writers 1241
20.4 The Console Class 1256
Review Questions 1259
20.5 Object Serialization 1261
Review Questions 1277

Chapter 21: Java I/O: Part II 1285
21.1 Characteristics of a Hierarchical File System 1287
21.2 Creating Path Objects 1289
21.3 Working with Path Objects 1294
21.4 Operations on Directory Entries 1304
21.5 Reading and Writing Files Using Paths 1314
21.6 Managing File Attributes 1321
21.7 Creating Directory Entries 1339
21.8 Stream Operations on Directory Entries 1345
Review Questions 1355

Chapter 22: Concurrency: Part I 1365
22.1 Threads and Concurrency 1367
22.2 Runtime Organization for Thread Execution 1369
22.3 Creating Threads 1370
Review Questions 1378
22.4 Thread Lifecycle 1380
22.5 Thread Issues 1408
Review Questions 1415

Chapter 23: Concurrency: Part II 1419
23.1 Utility Classes TimeUnit and ThreadLocalRandom 1421
23.2 The Executor Framework 1423
23.3 The Fork/Join Framework 1447
23.4 Writing Thread-Safe Code 1451
23.5 Special-Purpose Synchronizers 1470
23.6 Synchronized Collections and Maps 1477
23.7 Concurrent Collections and Maps 1482
Review Questions 1504

Chapter 24: Database Connectivity 1511
24.1 Introduction to Relational Databases 1512
24.2 Introduction to JDBC 1517
24.3 Establishing a Database Connection 1519
24.4 Creating and Executing SQL Statements 1522
24.5 Processing Query Results 1533
24.6 Customizing Result Sets 1539
24.7 Discovering Database and ResultSet Metadata 1543
24.8 Implementing Transaction Control 1545
Review Questions 1548

Chapter 25: Annotations 1555
25.1 Basics of Annotations 1557
25.2 Declaring Annotation Types 1558
25.3 Applying Annotations 1563
25.4 Meta-Annotations 1567
25.5 Selected Standard Annotations 1577
25.6 Processing Annotations 1587
Review Questions 1593

Chapter 26: Secure Coding 1599
26.1 Application Security Overview 1600
26.2 Security Threat Categories 1602
26.3 Java Security Policies 1608
26.4 Additional Security Guidelines 1610
Review Questions 1611

Appendix A: Taking the Java SE 17 and Java SE 11 Developer Exams 1615
A.1 Preparing for the Exam 1615
A.2 Registering for the Online Proctored Exam 1616
A.3 How the Online Proctored Exam Is Conducted 1618
A.4 The Questions 1619

Appendix B: Exam Topics: Java SE 17 Developer 1623

Appendix C: Exam Topics: Java SE 11 Developer 1629

Appendix D: Annotated Answers to Review Questions 1635

Appendix E: Mock Exam: Java SE 17 Developer 1709

Appendix F: Annotated Answers to Mock Exam 1737

Appendix G: Java Logging API Overview 1747
G.1 Purpose of the Logging API 1747
G.2 Configuring Logging 1748
G.3 Writing Log Messages 1749
G.4 Applying Guarded Logging 1751
G.5 Summary 1751

Index 1753

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020