OCP Oracle Certified Professional Java SE 11 Developer Complete Study Guide - Jeanne Boyarsky - E-Book

OCP Oracle Certified Professional Java SE 11 Developer Complete Study Guide E-Book

Jeanne Boyarsky

0,0
54,99 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.
Mehr erfahren.
Beschreibung

This OCP Oracle Certified Professional Java SE 11 Developer Complete Study Guide was published before Oracle announced major changes to its OCP certification program and the release of the new Developer 1Z0-819 exam. No matter the changes, rest assured this Study Guide covers everything you need to prepare for and take the exam. NOTE: The OCP Java SE 11 Programmer I Exam 1Z0-815 and Programmer II Exam 1Z0-816 have been retired (as of October 1, 2020), and Oracle has released a new Developer Exam 1Z0-819 to replace the previous exams. The Upgrade Exam 1Z0-817 remains the same. This is the most comprehensive prep guide available for the OCP Oracle Certified Professional Java SE 11 Developer certification--it covers Exam 1Z0-819 and the Upgrade Exam 1Z0-817 (as well as the retired Programmer I Exam 1Z0-815 and Programmer II Exam 1Z0-816)! Java is widely-used for backend cloud applications, Software as a Service applications (SAAS), and is the principal language used to develop Android applications. This object-oriented programming language is designed to run on all platforms that support Java without the need for recompilation. Oracle Java Programmer certification is highly valued by employers throughout the technology industry. The OCP Oracle Certified Professional Java SE 11 Developer Complete Study Guide in an indispensable resource for anyone preparing for the certification exam. This fully up-to-date guide covers 100% of exam objectives for Exam 1Z0-819 and Upgrade Exam 1Z0-817 (in addition to the previous Exam 1Z0-815 and Exam 1Z0-816). In-depth chapters present clear, comprehensive coverage of the functional-programming knowledge necessary to succeed. Each chapter clarifies complex material while reinforcing your understanding of vital exam topics. Also included is access to Sybex's superior online interactive learning environment and test bank that includes self-assessment tests, chapter tests, bonus practice exam questions, electronic flashcards, and a searchable glossary of important terms. The ultimate study aid for the challenging OCP exams, this popular guide: * Helps you master the changes in depth, difficultly, and new module topics of the latest OCP exams * Covers all exam objectives such as Java arrays, primitive data types, string APIs, objects and classes, operators and decision constructs, and applying encapsulation * Allows developers to catch up on all of the newest Java material like lambda expressions, streams, concurrency, annotations, generics, and modules * Provides practical methods for building Java applications, handling exceptions, programming through interfaces, secure coding in Java SE, and more * Enables you to gain the information, understanding, and practice you need to pass the OCP exams The OCP Oracle Certified Professional Java SE 11 Developer Complete Study Guide is a must-have book for certification candidates needing to pass these challenging exams, as well as junior- to senior-level developers who use Java as their primary programming language.

Sie lesen das E-Book in den Legimi-Apps auf:

Android
iOS
von Legimi
zertifizierten E-Readern

Seitenzahl: 1898

Veröffentlichungsjahr: 2020

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Cover

Acknowledgments

About the Authors

Introduction

Understanding the Exam

Reading This Book

Preparing for the Exam

Taking the Exam

Objective Map

Assessment Tests

PART I

Chapter 1: Welcome to Java

Learning About the Java Environment

Identifying Benefits of Java

Understanding the Java Class Structure

Writing a

main()

Method

Understanding Package Declarations and Imports

Ordering Elements in a Class

Code Formatting on the Exam

Summary

Exam Essentials

Review Questions

Chapter 2: Java Building Blocks

Creating Objects

Understanding Data Types

Declaring Variables

Initializing Variables

Managing Variable Scope

Destroying Objects

Summary

Exam Essentials

Review Questions

Chapter 3: Operators

Understanding Java Operators

Applying Unary Operators

Working with Binary Arithmetic Operators

Assigning Values

Comparing Values

Making Decisions with the Ternary Operator

Summary

Exam Essentials

Review Questions

Chapter 4: Making Decisions

Creating Decision-Making Statements

Writing

while

Loops

Constructing

for

Loops

Controlling Flow with Branching

Summary

Exam Essentials

Review Questions

Chapter 5: Core Java APIs

Creating and Manipulating Strings

Using the

StringBuilder

Class

Understanding Equality

Understanding Java Arrays

Understanding an

ArrayList

Creating Sets and Maps

Calculating with Math APIs

Summary

Exam Essentials

Review Questions

Chapter 6: Lambdas and Functional Interfaces

Writing Simple Lambdas

Introducing Functional Interfaces

Working with Variables in Lambdas

Calling APIs with Lambdas

Summary

Exam Essentials

Review Questions

Chapter 7: Methods and Encapsulation

Designing Methods

Working with Varargs

Applying Access Modifiers

Applying the

static

Keyword

Passing Data among Methods

Overloading Methods

Encapsulating Data

Summary

Exam Essentials

Review Questions

Chapter 8: Class Design

Understanding Inheritance

Creating Classes

Declaring Constructors

Inheriting Members

Understanding Polymorphism

Summary

Exam Essentials

Review Questions

Chapter 9: Advanced Class Design

Creating Abstract Classes

Implementing Interfaces

Introducing Inner Classes

Summary

Exam Essentials

Review Questions

Chapter 10: Exceptions

Understanding Exceptions

Recognizing Exception Classes

Handling Exceptions

Calling Methods That Throw Exceptions

Summary

Exam Essentials

Review Questions

Chapter 11: Modules

Introducing Modules

Creating and Running a Modular Program

Updating Our Example for Multiple Modules

Diving into the

module-info

File

Discovering Modules

Reviewing Command-Line Options

Summary

Exam Essentials

Review Questions

PART II

Chapter 12: Java Fundamentals

Applying the

final

Modifier

Working with Enums

Creating Nested Classes

Understanding Interface Members

Introducing Functional Programming

Summary

Exam Essentials

Review Questions

Chapter 13: Annotations

Introducing Annotations

Creating Custom Annotations

Applying Annotations

Declaring Annotation‐Specific Annotations

Using Common Annotations

Summary

Exam Essentials

Review Questions

Chapter 14: Generics and Collections

Using Method References

Using Wrapper Classes

Using the Diamond Operator

Using Lists, Sets, Maps, and Queues

Sorting Data

Working with Generics

Summary

Exam Essentials

Review Questions

Chapter 15: Functional Programming

Working with Built‐in Functional Interfaces

Returning an

Optional

Using Streams

Working with Primitive Streams

Working with Advanced Stream Pipeline Concepts

Summary

Exam Essentials

Review Questions

Chapter 16: Exceptions, Assertions, and Localization

Reviewing Exceptions

Creating Custom Exceptions

Automating Resource Management

Declaring Assertions

Working with Dates and Times

Supporting Internationalization and Localization

Loading Properties with Resource Bundles

Summary

Exam Essentials

Review Questions

Chapter 17: Modular Applications

Reviewing Module Directives

Comparing Types of Modules

Analyzing JDK Dependencies

Migrating an Application

Creating a Service

Summary

Exam Essentials

Review Questions

Chapter 18: Concurrency

Introducing Threads

Creating Threads with the Concurrency API

Writing Thread‐Safe Code

Using Concurrent Collections

Identifying Threading Problems

Working with Parallel Streams

Summary

Exam Essentials

Review Questions

Chapter 19: I/O

Understanding Files and Directories

Introducing I/O Streams

Common I/O Stream Operations

Working with I/O Stream Classes

Interacting with Users

Summary

Exam Essentials

Review Questions

Chapter 20: NIO.2

Introducing NIO.2

Interacting with Paths

Operating on Files and Directories

Managing File Attributes

Applying Functional Programming

Comparing Legacy java.io.File and NIO.2 Methods

Summary

Exam Essentials

Review Questions

Chapter 21: JDBC

Introducing Relational Databases and SQL

Introducing the Interfaces of JDBC

Connecting to a Database

Working with a

PreparedStatement

Getting Data from a ResultSet

Calling a

CallableStatement

Closing Database Resources

Summary

Exam Essentials

Review Questions

Chapter 22: Security

Designing a Secure Object

Introducing Injection and Input Validation

Working with Confidential Information

Serializing and Deserializing Objects

Constructing Sensitive Objects

Preventing Denial of Service Attacks

Summary

Exam Essentials

Review Questions

Appendix: Answers to Review Questions

Chapter 1: Welcome to Java

Chapter 2: Java Building Blocks

Chapter 3: Operators

Chapter 4: Making Decisions

Chapter 5: Core Java APIs

Chapter 6: Lambdas and Functional Interfaces

Chapter 7: Methods and Encapsulation

Chapter 8: Class Design

Chapter 9: Advanced Class Design

Chapter 10: Exceptions

Chapter 11: Modules

Chapter 12: Java Fundamentals

Chapter 13: Annotations

Chapter 14: Generics and Collections

Chapter 15: Functional Programming

Chapter 16: Exceptions, Assertions, and Localization

Chapter 17: Modular Applications

Chapter 18: Concurrency

Chapter 19: I/O

Chapter 20: NIO.2

Chapter 21: JDBC

Chapter 22: Security

Index

Online Test Bank

Register and Access the Online Test Bank

End User License Agreement

List of Tables

Introduction

TABLE I.1 Exam information

Chapter 1

TABLE 1.1 Running programs

TABLE 1.2 Setup procedure by operating system

TABLE 1.3 Options you need to know for the exam:

javac

TABLE 1.4 Options you need to know for the exam:

java

TABLE 1.5 Options you need to know for the exam:

jar

TABLE 1.6 Order for declaring a

class

Chapter 2

TABLE 2.1 Primitive types

TABLE 2.2 Reserved words

TABLE 2.3 Default initialization values by type

TABLE 2.4 Tracking scope by block

Chapter 3

TABLE 3.1 Order of operator precedence

TABLE 3.2 Unary operators

TABLE 3.3 Binary arithmetic operators

TABLE 3.4 Simple assignment operator

TABLE 3.5 Compound assignment operators

TABLE 3.6 Equality operators

TABLE 3.7 Relational operators

TABLE 3.8 Logical operators

TABLE 3.9 Short-circuit operators

Chapter 4

TABLE 4.1 Advanced flow control usage

Chapter 5

TABLE 5.1 Binary search rules

TABLE 5.2

Arrays.compare()

examples

TABLE 5.3 Equality vs. comparison vs. mismatch

TABLE 5.4 Wrapper classes

TABLE 5.5 Converting from a

String

TABLE 5.6 Array and list conversions

TABLE 5.7 Common

Map

methods

Chapter 6

TABLE 6.1 Valid lambdas

TABLE 6.2 Invalid lambdas that return

boolean

TABLE 6.3 Basic functional interfaces

TABLE 6.4 Rules for accessing a variable from a lambda body inside a method

Chapter 7

TABLE 7.1 Parts of a method declaration

TABLE 7.2 Access modifiers

TABLE 7.3 Static vs. instance calls

TABLE 7.4 The order that Java uses to choose the right overloaded method

TABLE 7.5 Naming conventions for getters and setters

Chapter 10

TABLE 10.1 Types of exceptions and errors

TABLE 10.2 Legal vs. illegal configurations with a traditional

try

statement

TABLE 10.3 Legal vs. illegal configurations with a try-with-resources statement

Chapter 11

TABLE 11.1 Options you need to know for using modules with

javac

TABLE 11.2 Options you need to know for using modules with

java

TABLE 11.3 Access control with modules

TABLE 11.4 Modes using

jmod

TABLE 11.5 Comparing command-line operations

TABLE 11.6 Options you need to know for the exam:

javac

TABLE 11.7 Options you need to know for the exam:

java

TABLE 11.8 Options you need to know for the exam:

jar

TABLE 11.9 Options you need to know for the exam:

jdeps

Chapter 12

TABLE 12.1 Modifiers in nested classes

TABLE 12.2 Members in nested classes

TABLE 12.3 Nested class access rules

TABLE 12.4 Interface member types

TABLE 12.5 Interface member access

Chapter 13

TABLE 13.1 Values for the

@Target

annotation

TABLE 13.2 Values for the @Retention annotation

TABLE 13.3 Annotation‐specific annotations

TABLE 13.4 Common @

SuppressWarnings

values

TABLE 13.5 Understanding common annotations

TABLE 13.6 Applying common annotations

Chapter 14

TABLE 14.1 Functional interfaces used in this chapter

TABLE 14.2 Method references

TABLE 14.3 Wrapper classes

TABLE 14.4 Factory methods to create a List

TABLE 14.5 List methods

TABLE 14.6 Queue methods

TABLE 14.7 Map methods

TABLE 14.8 Behavior of the merge() method

TABLE 14.9 Java Collections Framework types

TABLE 14.10 Collection attributes

TABLE 14.11 Comparison of Comparable and Comparator

TABLE 14.12 Helper static methods for building a Comparator

TABLE 14.13 Helper default methods for building a Comparator

TABLE 14.14 Types of bounds

TABLE 14.15 Why we need a lower bound

Chapter 15

TABLE 15.1 Common functional interfaces

TABLE 15.2 Convenience methods

TABLE 15.3

Optional

instance methods

TABLE 15.4 Intermediate vs. terminal operations

TABLE 15.5 Creating a source

TABLE 15.6 Terminal stream operations

TABLE 15.7 Common primitive stream methods

TABLE 15.8 Mapping methods between types of streams

TABLE 15.9 Function parameters when mapping between types of streams

TABLE 15.10 Optional types for primitives

TABLE 15.11 Common functional interfaces for primitives

TABLE 15.12 Primitive‐specific functional interfaces

TABLE 15.13 Examples of grouping/partitioning collectors

Chapter 16

TABLE 16.1 Unchecked exceptions

TABLE 16.2 Checked exceptions

TABLE 16.3 Assertion applications

TABLE 16.4 Date and time types

TABLE 16.5 Common date/time symbols

TABLE 16.6 Supported date/time symbols

TABLE 16.7 Factory methods to get a

NumberFormat

TABLE 16.8

DecimalFormat

symbols

TABLE 16.9 Factory methods to get a

DateTimeFormatter

TABLE 16.10

Locale.Category

values

TABLE 16.11 Picking a resource bundle for French/France with default locale E...

TABLE 16.12 Selecting resource bundle properties

Chapter 17

TABLE 17.1 Common module directives

TABLE 17.2 Practicing with automatic module names

TABLE 17.3 Properties of modules types

TABLE 17.4 Common modules

TABLE 17.5 Java modules prefixed with java

TABLE 17.6 Java modules prefixed with jdk

TABLE 17.7 Comparing migration strategies

TABLE 17.8 Reviewing services

Chapter 18

TABLE 18.1

ExecutorService

methods

TABLE 18.2

Future

methods

TABLE 18.3

TimeUnit

values

TABLE 18.4

ScheduledExecutorService

methods

TABLE 18.5

Executors

factory methods

TABLE 18.6 Atomic classes

TABLE 18.7 Common atomic methods

TABLE 18.8

Lock

methods

TABLE 18.9 Concurrent collection classes

TABLE 18.10

BlockingQueue

waiting methods

TABLE 18.11 Synchronized collections methods

Chapter 19

TABLE 19.1 Commonly used java.io.File methods

TABLE 19.2 The java.io abstract stream base classes

TABLE 19.3 The java.io concrete stream classes

TABLE 19.4 Common I/O stream methods

TABLE 19.5 Common print stream

format()

symbols

Chapter 20

TABLE 20.1 File system symbols

TABLE 20.2 Common NIO.2 method arguments

TABLE 20.3 Path methods

TABLE 20.4

Files

methods

TABLE 20.5 The attributes and view types

TABLE 20.6 Walking a directory with a cycle using breadth‐first search

TABLE 20.7 Comparison of

java.io.File

and NIO.2 methods

Chapter 21

TABLE 21.1 CRUD operations

TABLE 21.2 SQL runnable by the

execute

method

TABLE 21.3 Return types of

execute

methods

TABLE 21.4

PreparedStatement

methods

TABLE 21.5

ResultSet get

methods

TABLE 21.6 Sample stored procedures

TABLE 21.7 Stored procedure parameter types

Chapter 22

TABLE 22.1 Types of confidential data

TABLE 22.2 Methods for serialization and deserialization

List of Illustrations

Introduction

FIGURE I.1 Past and current Java certifications

FIGURE I.2 Latest Java certification exams

FIGURE I.3 Exam prerequisites

Chapter 1

FIGURE 1.1 Compiling with packages

FIGURE 1.2 Compiling with packages and directories

Chapter 2

FIGURE 2.1 An object in memory can be accessed only via a reference.

FIGURE 2.2 Your drawing after line 5

FIGURE 2.3 Your drawing after line 7

Chapter 3

FIGURE 3.1 The logical truth tables for &, |, and ^

Chapter 4

FIGURE 4.1 The structure of an if statement

FIGURE 4.2 The structure of an else statement

FIGURE 4.3 The structure of a switch statement

FIGURE 4.4 The structure of a while statement

FIGURE 4.5 The structure of a do/while statement

FIGURE 4.6 The structure of a basic for loop

FIGURE 4.7 The structure of an enhanced for-each loop

FIGURE 4.8 The structure of a break statement

FIGURE 4.9 The structure of a continue statement

Chapter 5

FIGURE 5.1 Indexing for a string

FIGURE 5.2 Indexes for a substring

FIGURE 5.3 The basic structure of an array

FIGURE 5.4 An empty array

FIGURE 5.5 An initialized array

FIGURE 5.6 An array pointing to strings

FIGURE 5.7 A sparsely populated multidimensional array

FIGURE 5.8 An asymmetric multidimensional array

FIGURE 5.9 Example of a Set

FIGURE 5.10 Example of a Map

Chapter 6

FIGURE 6.1 Lambda syntax omitting optional parts

FIGURE 6.2 Lambda syntax, including optional parts

Chapter 7

FIGURE 7.1 Method declaration

FIGURE 7.2 Classes used to show private and default access

FIGURE 7.3 Classes used to show protected access

FIGURE 7.4 Copying a reference with pass-by-value

Chapter 8

FIGURE 8.1 Types of inheritance

FIGURE 8.2 Java object inheritance

FIGURE 8.3 Defining and extending a class

FIGURE 8.4 Object vs. reference

Chapter 9

FIGURE 9.1 Defining an interface

FIGURE 9.2 Implementing an interface

FIGURE 9.3 Interface Inheritance

Chapter 10

FIGURE 10.1 Categories of exception

FIGURE 10.2 The syntax of a try statement

FIGURE 10.3 The syntax of a multi-catch block

FIGURE 10.4 The syntax of a try statement with finally

FIGURE 10.5 The syntax of a basic try-with-resources

FIGURE 10.6 The syntax of try-with-resources including catch/finally

FIGURE 10.7 A method stack

Chapter 11

FIGURE 11.1 Design of a modular system

FIGURE 11.2 Looking inside a module

FIGURE 11.3 Contents of zoo.animal.feeding

FIGURE 11.4 Module zoo.animal.feeding directory structure

FIGURE 11.5 Running a module using java

FIGURE 11.6 Module zoo.animal.feeding directory structure with class and jar fil...

FIGURE 11.7 Modules depending on zoo.animal.feeding

FIGURE 11.8 Contents of zoo.animal.care

FIGURE 11.9 Module zoo.animal.care directory structure

FIGURE 11.10 Dependencies for zoo.animal.talks

FIGURE 11.11 Contents of zoo.animal.talks

FIGURE 11.12 Contents of zoo.staff

FIGURE 11.13 Dependencies for zoo.staff

FIGURE 11.14 Transitive dependency version of our modules

Chapter 12

FIGURE 12.1 Lambda syntax omitting optional parts

FIGURE 12.2 Lambda syntax, including optional parts

Chapter 13

FIGURE 13.1 Annotation declaration

FIGURE 13.2 Using an annotation

Chapter 14

FIGURE 14.1 The

Collection

interface is the root of all collections except m...

FIGURE 14.2 Example of a

List

FIGURE 14.3 Example of a

Set

FIGURE 14.4 Examples of a

HashSet

and

TreeSet

FIGURE 14.5 Example of a

Queue

FIGURE 14.6 Working with a queue

FIGURE 14.7 Example of a

Map

Chapter 15

FIGURE 15.1

Optional

FIGURE 15.2 Stream pipeline

FIGURE 15.3 Steps in running a stream pipeline

FIGURE 15.4 A stream pipeline with a limit

FIGURE 15.5 Stream pipeline with multiple intermediate operations

Chapter 16

FIGURE 16.1 The syntax of a

try

statement

FIGURE 16.2 The syntax of a try‐with‐resources statement

FIGURE 16.3 Categories of exceptions

FIGURE 16.4 The syntax of

assert

statements

FIGURE 16.5

Locale

formats

Chapter 17

FIGURE 17.1 A named module

FIGURE 17.2 An automatic module

FIGURE 17.3 An unnamed module

FIGURE 17.4 Determining the order

FIGURE 17.5 Determining the order when not unique

FIGURE 17.6 Bottom‐up migration

FIGURE 17.7 Top‐down migration

FIGURE 17.8 First attempt at decomposition

FIGURE 17.9 Removing the cyclic dependencies

FIGURE 17.10 Modules in the tour application

Chapter 18

FIGURE 18.1 Process model

FIGURE 18.2

ExecutorService

life cycle

FIGURE 18.3 Lack of thread synchronization

FIGURE 18.4 Thread synchronization using atomic operations

FIGURE 18.5 Race condition on user creation

Chapter 19

FIGURE 19.1 Directory and file hierarchy

FIGURE 19.2 Visual representation of a stream

FIGURE 19.3 Serialization process

FIGURE 19.4 Diagram of I/O stream classes

Chapter 20

FIGURE 20.1 File system with a symbolic link

FIGURE 20.2 NIO.2 class and interface relationships

FIGURE 20.3 Relative paths using path symbols

FIGURE 20.4 Comparing file uniqueness

FIGURE 20.5 File and directory as a tree structure

FIGURE 20.6 File system with cycle

Chapter 21

FIGURE 21.1 Tables in our relational database

FIGURE 21.2 Key JDBC interfaces

FIGURE 21.3 The JDBC URL format

FIGURE 21.4 Types of statements

FIGURE 21.5 The

ResultSet

cursor

Chapter 22

FIGURE 22.1

Cloneable

logic

FIGURE 22.2 Hours table

FIGURE 22.3 Directory structure

FIGURE 22.4 Writing and reading an employee

Guide

Cover

Table of Contents

Begin Reading

Pages

iii

iv

v

vi

vii

xxix

xxx

xxxi

xxxii

xxxiii

xxxiv

xxxv

xxxvi

xxxvii

xxxviii

xxxix

xl

xli

xlii

xliii

xliv

xlv

xlvi

xlvii

xlviii

xlix

l

li

lii

liii

liv

lv

lvi

lvii

lviii

lix

lx

lxi

lxii

lxiii

lxiv

lxv

lxvi

lxvii

lxviii

lxix

lxx

lxxi

lxxii

lxxiii

lxxiv

lxxv

lxxvi

lxxvii

lxxviii

lxxix

lxxx

lxxxi

lxxxii

lxxxiii

lxxxiv

lxxxv

lxxxvi

1

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399

400

401

403

404

405

406

407

408

409

410

411

412

413

414

415

416

417

418

419

420

421

422

423

424

425

426

427

428

429

430

431

432

433

434

435

436

437

438

439

440

441

442

443

444

445

446

447

448

449

450

451

452

453

454

455

456

457

458

459

460

461

462

463

464

465

466

467

468

469

470

471

472

473

474

475

476

477

478

479

480

481

482

483

484

485

486

487

488

489

490

491

492

493

495

496

497

498

499

500

501

502

503

504

505

506

507

508

509

510

511

512

513

514

515

516

517

518

519

520

521

522

523

524

525

526

527

528

529

530

531

532

533

534

535

536

537

538

539

540

541

542

543

544

545

546

547

548

549

550

551

552

553

554

555

556

557

558

559

560

561

562

563

564

565

566

567

568

569

570

571

572

573

574

575

576

577

578

579

580

581

582

583

584

585

586

587

588

589

590

591

592

593

594

595

596

597

599

600

601

602

603

604

605

606

607

608

609

610

611

612

613

614

615

616

617

618

619

620

621

622

623

624

625

626

627

628

629

630

631

632

633

634

635

636

637

638

639

640

641

642

643

644

645

646

647

648

649

650

651

652

653

654

655

656

657

658

659

660

661

662

663

664

665

666

667

668

669

670

671

672

673

674

675

676

677

678

679

680

681

682

683

684

685

686

687

688

689

690

691

692

693

694

695

696

697

698

699

700

701

702

703

704

705

706

707

708

709

710

711

712

713

714

715

716

717

718

719

720

721

722

723

724

725

726

727

728

729

730

731

732

733

734

735

736

737

738

739

740

741

742

743

744

745

746

747

748

749

750

751

752

753

754

755

756

757

758

759

760

761

762

763

764

765

766

767

768

769

770

771

772

773

774

775

776

777

778

779

780

781

782

783

784

785

786

787

788

789

790

791

792

793

794

795

796

797

798

799

800

801

803

804

805

806

807

808

809

810

811

812

813

814

815

816

817

818

819

820

821

822

823

824

825

826

827

828

829

830

831

832

833

834

835

836

837

838

839

840

841

842

843

844

845

846

847

848

849

850

851

852

853

854

855

856

857

858

859

860

861

862

863

864

865

866

867

868

869

870

871

872

873

874

875

876

877

878

879

880

881

882

883

884

885

886

887

888

889

890

891

892

893

894

895

896

897

898

899

900

901

902

903

904

905

906

907

908

909

910

911

912

913

914

915

916

917

918

919

920

921

922

923

924

925

926

927

928

929

930

931

932

933

934

935

936

937

938

939

940

941

942

943

944

945

946

947

948

949

950

951

952

953

954

955

956

957

958

959

960

961

962

963

964

965

966

967

969

970

971

972

973

974

975

976

977

978

979

980

981

982

983

984

985

986

987

988

989

990

991

992

993

994

995

996

997

998

999

1000

1001

1002

1003

1004

1005

1006

1007

1008

1009

1010

1011

1012

1013

1014

1015

1016

1017

1018

1019

1020

1021

1023

1024

1025

1026

1027

1028

1029

1030

1031

1032

1033

1034

1035

1036

1037

1038

1039

1040

1041

1042

1043

1044

1045

1046

1047

1048

1049

1050

1051

1052

1053

1054

1055

1056

1057

1058

1059

1060

1061

1062

1063

1064

1065

1066

1067

1068

1069

1070

1071

1072

1073

1074

1075

1076

1077

1078

1079

1080

1081

1082

1083

1084

1085

1086

1087

1088

1089

1090

1091

1092

1093

1094

1095

1096

1097

1098

1099

1100

1101

1102

1103

1104

1105

1106

1107

1108

1109

1110

1111

1112

1113

1114

1115

1116

1117

1118

1119

1120

1121

1122

1123

1124

1125

1126

1127

1128

1129

1130

1131

1132

1133

1134

1135

1136

1137

1138

1139

1140

1141

1142

1143

1144

1145

1146

1147

1148

1149

1150

1151

1152

1153

1154

1155

1156

1157

1158

1159

1160

1161

1162

1163

1164

1165

1166

1167

1168

1169

1170

1171

1172

1173

1174

1175

1176

1177

1178

1179

1180

1181

1182

1183

1184

1185

1186

1187

1188

1189

1190

1191

1192

1193

1194

1195

1196

1197

1198

1199

1200

1201

1202

1203

OCPOracle® Certified Professional Java® SE 11 Developer

Complete Study Guide Exam 1Z0-819 and upgrade Exam 1Z0-817

Jeanne Boyarsky

Scott Selikoff

 

 

 

Copyright © 2020 by John Wiley & Sons, Inc., Indianapolis, Indiana

Published simultaneously in Canada and the United Kingdom

ISBN: 978-1-119-61913-0ISBN: 978-1-119-61915-4 (ebk.)ISBN: 978-1-119-61914-7 (ebk.)

No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions.

Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Web site may provide or recommendations it may make. Further, readers should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was written and when it is read.

For general information on our other products and services or to obtain technical support, please contact our Customer Care Department within the U.S. at (877) 762-2974, outside the U.S. at (317) 572-3993 or fax (317) 572-4002.

Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD or DVD that is not included in the version you purchased, you may download this material at http://booksupport.wiley.com. For more information about Wiley products, visit www.wiley.com.

Library of Congress Control Number: 2020938721

TRADEMARKS: Wiley, the Wiley logo, and the Sybex logo are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries, and may not be used without written permission. Oracle and Java are registered trademarks of Oracle, Inc. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.

Happy 20th anniversary to NYC FIRST and StuyPulse FRC Team 694.

—Jeanne

For my daughter, Olivia, your determination and strength of heart are one of a kind. Your smile brightens even the darkest days. May your life be filled with happiness and love.

—Scott

Acknowledgments

Jeanne and Scott would like to thank numerous individuals for their contribution to this book. Thank you to Kathryn Duggan for guiding us through the process and making the book better in so many ways. Thank you to Janeice DelVecchio for being our technical editor as we wrote this book. Janeice pointed out many subtle errors in addition to the big ones. And thank you to Elena Felder for being our technical proofreader and finding the errors that we managed to sneak by Janeice. This book also wouldn't be possible without many people at Wiley, including Kenyon Brown, Pete Gaughan, Christine O'Connor, Barath Kumar Rajasekaran, Kim Wimpsett, Johnna VanHoose Dinse, and so many others.

Jeanne would personally like to thank Chris Kreussling for knowing more than a decade ago that she would someday write a book. He was a great mentor for many years and definitely shaped her career. Sibon Barman was helpful in getting feedback on the modules chapter, and Susanta Chattopadhyay provided real‐life use cases for both service locator and serialization. Stuart Dabbs Halloway's 2001 book provided examples of serialPeristentFields. Scott was a great co‐author, improving everything Jeanne wrote while writing his own chapters. A big thank you to everyone at CodeRanch.com who asked and responded to questions and comments about our books. Finally, Jeanne would like to thank all of the new programmers at CodeRanch.com and FIRST robotics teams FRC 694, FTC 310, and FTC 479 for the constant reminders of how new programmers think.

Scott could not have reached this point without his wife, Patti, and family, whose love and support makes this book possible. He would like to thank his twin daughters, Olivia and Sophia, and youngest daughter, Elysia, for their patience and understanding especially when it was “time for Daddy to work in his office!” Scott would like to extend his gratitude to his wonderfully patient co‐author, Jeanne, on this, their fifth book. He doesn't know how she puts up with him, but he's glad she does and thrilled at the quality of books we produce. A big thanks to Matt Dalen, who has been a great friend, sounding board, and caring father to Olivia, Adeline, and newborn Henry. Finally, Scott would like to thank his mother and retired teacher, Barbara Selikoff, for teaching him the value of education, and his father, Mark Selikoff, for instilling in him the benefits of working hard.

We'd both like to thank Marcus Biel for providing a European's take on our localization content. Last but not least, both Jeanne and Scott would like to give a big thank you to the readers of all our books. Hearing from all of you who enjoyed the book and passed the exam is a great feeling. We'd also like to thank those who pointed out errors and made suggestions for improvements in the 1Z0‐815 Java 11 book. As of May 2020, the top two were Nikolai Vinoku and Edmond Yong. Also, an honorable mention to Jakub Chrobak. Finally, thank you to Atanas Gegov for submitting a pull request to improve the 1Z0‐815 modules examples readme.

About the Authors

Jeanne Boyarsky was selected as a Java Champion in 2019. She has worked as a Java developer for more than 18 years at a bank in New York City where she develops, mentors, and conducts training. Besides being a senior moderator at CodeRanch.com in her free time, she works on the forum code base. Jeanne also mentors the programming division of a FIRST robotics team where she works with students just getting started with Java. She also speaks at several conferences each year.

Jeanne got her Bachelor of Arts degree in 2002 and her Master in Computer Information Technology degree in 2005. She enjoyed getting her Master's degree in an online program while working full‐time. This was before online education was cool! Jeanne is also a Distinguished Toastmaster and a Scrum Master. You can find out more about Jeanne at www.jeanneboyarsky.com or follow her on Twitter @JeanneBoyarsky.

Scott Selikoff is a professional software consultant, author, and owner of Selikoff Solutions, LLC, which provides software development solutions to businesses in the tri‐state New York City area. Skilled in a plethora of software languages and platforms, Scott specializes in full‐stack database‐driven systems, cloud‐based applications, microservice architectures, and service‐oriented architectures.

A native of Toms River, New Jersey, Scott achieved his Bachelor of Arts degree from Cornell University in Mathematics and Computer Science in 2002, after three years of study. In 2003, he received his Master of Engineering degree in Computer Science, also from Cornell University.

As someone with a deep love of education, Scott has always enjoyed teaching others new concepts. He's given lectures at Cornell University and Rutgers University, as well as conferences including Oracle Code One and The Server Side Java Symposium. Scott lives in New Jersey with his loving wife, Patti; three amazing daughters, twins Olivia and Sophia and little Elysia; and two very playful dogs, Webby and Georgette. You can find out more about Scott at www.linkedin.com/in/selikoff or follow him on Twitter @ScottSelikoff.

Jeanne and Scott are both moderators on the CodeRanch.com forums and can be reached there for question and comments. They also co‐author a technical blog called Down Home Country Coding at www.selikoff.net.

In addition to this book, Jeanne and Scott are also authors of the following best‐selling Java 8 certification books: OCA Oracle Certified Associate Java SE 8 Programmer I Study Guide (Sybex, 2015) and OCP Oracle Certified Professional Java SE 8 Programmer II Study Guide (Sybex, 2016). These two books have been combined into the single release: OCA/OCP Java SE 8 Programmer Certification Kit: Exam 1Z0‐808 and Exam 1Z0‐809 (Sybex 2016). They have also written a book of practice test questions for the Java 8 certification exams: OCA/OCP Java SE 8 Programmer Practice Tests (Sybex, 2017). Their most recent books are OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0‐815 (Sybex, 2019) and OCP Oracle Certified Professional Java SE 11 Programmer II Study Guide: Exam 1Z0‐816 (Sybex, 2020).