TIENE EN SU CESTA DE LA COMPRA
en total 0,00 €
Complete, trusted preparation for the Java Programmer II exam
OCP: Oracle Certified Professional Java SE 8 Programmer II Study Guide is your comprehensive companion for preparing for Exam 1Z0-809 as well as upgrade Exam 1Z0-810 and Exam 1Z0-813. With full coverage of 100% of exam objectives, this invaluable guide reinforces what you know, teaches you what you don´t know, and gives you the hands-on practice you need to boost your skills. Written by expert Java developers, this book goes beyond mere exam prep with the insight, explanations and perspectives that come from years of experience. You´ll review the basics of object-oriented programming, understand functional programming, apply your knowledge to database work, and much more. From the basic to the advanced, this guide walks you through everything you need to know to confidently take the OCP 1Z0-809 Exam and upgrade exams 1Z0-810 and 1Z0-813.
Java 8 represents the biggest changes to the language to date, and the latest exam now requires that you demonstrate functional programming competence in order to pass. This guide has you covered, with clear explanations and expert advice.
Understand abstract classes, interfaces, and class design
Learn object-oriented design principles and patterns
Delve into functional programming, advanced strings, and localization
Master IO, NIO, and JDBC with expert-led database practice
If you´re ready to take the next step in your IT career, OCP: Oracle
Table of Contents
Introduction xix
Assessment Test xxxviii
Chapter 1 Advanced Class Design 1
Reviewing OCA Concepts 2
Access Modifiers 2
Overloading and Overriding 4
Abstract Classes 5
Static and Final 6
Imports 6
Using instanceof 7
Understanding Virtual Method Invocation 9
Annotating Overridden Methods 11
Coding equals, hashCode, and toString 13
toString 13
equals 15
hashCode 18
Working with Enums 20
Using Enums in Switch Statements 21
Adding Constructors, Fields, and Methods 22
Creating Nested Classes 24
Member Inner Classes 25
Local Inner Classes 27
Anonymous Inner Classes 29
Static Nested Classes 31
Summary 33
Exam Essentials 34
Review Questions 36
Chapter 2 Design Patterns and Principles 47
Designing an Interface 48
Purpose of an Interface 51
Introducing Functional Programming 52
Defining a Functional Interface 53
Implementing Functional Interfaces with Lambdas 55
Applying the Predicate Interface 60
Implementing Polymorphism 61
Distinguishing between an Object and a Reference 63
Casting Object References 64
Understanding Design Principles 66
Encapsulating Data 66
Creating JavaBeans 69
Applying the Is ]a Relationship 71
Applying the Has ]a Relationship 73
Composing Objects 74
Working with Design Patterns 75
Applying the Singleton Pattern 76
Creating Immutable Objects 82
Using the Builder Pattern 86
Creating Objects with the Factory Pattern 89
Summary 93
Exam Essentials 93
Review Questions 95
Chapter 3 Generics and Collections 103
Reviewing OCA Collections 104
Array and ArrayList 104
Searching and Sorting 105
Wrapper Classes and Autoboxing 106
The Diamond Operator 107
Working with Generics 108
Generic Classes 109
Generic Interfaces 112
Generic Methods 114
Interacting with Legacy Code 114
Bounds 117
Putting It All Together 122
Using Lists, Sets, Maps, and Queues 124
Common Collections Methods 125
Using the List Interface 127
Using the Set Interface 132
Using the Queue Interface 134
Map 138
Comparing Collection Types 140
Comparator vs. Comparable 143
Comparable 143
Comparator 146
Searching and Sorting 150
Additions in Java 8 152
Using Method References 152
Removing Conditionally 154
Updating All Elements 155
Looping through a Collection 155
Using New Java 8 Map APIs 155
Summary 159
Exam Essentials 161
Review Questions 162
Chapter 4 Functional Programming 171
Using Variables in Lambdas 172
Working with Built-In Functional Interfaces 173
Implementing Supplier 174
Implementing Consumer and BiConsumer 175
Implementing Predicate and BiPredicate 177
Implementing Function and BiFunction 178
Implementing UnaryOperator and BinaryOperator 180
Checking Functional Interfaces 181
Returning an Optional 182
Using Streams 185
Creating Stream Sources 188
Using Common Terminal Operations 189
Using Common Intermediate Operations 196
Putting Together the Pipeline 200
Printing a Stream 204
Working with Primitives 205
Creating Primitive Streams 205
Using Optional with Primitive Streams 208
Summarizing Statistics 210
Learning the Functional Interfaces for Primitives 210
Working with Advanced Stream Pipeline Concepts 213
Linking Streams to the Underlying Data 213
Chaining Optionals 214
Collecting Results 217
Summary 223
Exam Essentials 224
Review Questions 226
Chapter 5 Dates, Strings, and Localization 233
Working with Dates and Times 234
Creating Dates and Times 235
Manipulating Dates and Times 241
Working with Periods 244
Working with Durations 247
Accounting for Daylight Savings Time 251
Reviewing the String class 253
Adding Internationalization and Localization 255
Picking a Locale 256
Using a Resource Bundle 258
Formatting Numbers 267
Formatting Dates and Times 270
Summary 273
Exam Essentials 274
Review Questions 276
Chapter 6 Exceptions and Assertions 283
Reviewing Exceptions 284
Exceptions Terminology 284
Categories of Exceptions 285
Exceptions on the OCP 286
Try Statement 288
Throw vs. Throws 289
Creating Custom Exceptions 289
Using Multi-catch 291
Using Try-With-Resources 296
Try-With-Resources Basics 298
AutoCloseable 300
Suppressed Exceptions 302
Putting It Together 305
Rethrowing Exceptions 305
Working with Assertions 308
The assert Statement 308
Enabling Assertions 309
Using Assertions 310
Summary 314
Exam Essentials 315
Review Questions 316
Chapter 7 Concurrency 325
Introducing Threads 327
Distinguishing Thread Types 328
Understanding Thread Concurrency 328
Introducing Runnable 330
Creating a Thread 331
Polling with Sleep 334
Creating Threads with the ExecutorService 335
Introducing the Single-Thread Executor 335
Shutting Down a Thread Executor 337
Submitting Tasks 338
Waiting for Results 340
Scheduling Tasks 345
Increasing Concurrency with Pools 348
Synchronizing Data Access 350
Protecting Data with Atomic Classes 352
Improving Access with Synchronized Blocks 354
Synchronizing Methods 356
Understanding the Cost of Synchronization 357
Using Concurrent Collections 358
Introducing Concurrent Collections 358
Understanding Memory Consistency Errors 359
Working with Concurrent Classes 360
Obtaining Synchronized Collectio