OCP Oracle Certified Professional Java SE 17 Developer Study Guide
Реклама. ООО «ЛитРес», ИНН: 7719571260.
Оглавление
Jeanne Boyarsky. OCP Oracle Certified Professional Java SE 17 Developer Study Guide
Table of Contents
List of Tables
List of Illustrations
Guide
Pages
OCP Oracle® Certified Professional Java SE 17 Developer Study Guide. Exam 1Z0-829
Acknowledgments
About the Authors
About the Technical Editor
About the Technical Proofreader
Introduction
Understanding the Exam
Choosing Which Exam to Take
Considering the Exam Objectives
Changes to the Exams
Scope of Objectives
Choosing the Correct Answer(s)
Reading the Exam Code
Encountering Out-of-Scope Material
Reviewing Question Types
Reading This Book
Who Should Buy This Book
How This Book Is Organized
Conventions Used in This Book
Sidebars
Real World Scenaria
Getting Help
Interactive Online Learning Environment and Test Bank
Studying for the Exam
Creating a Study Plan
Creating and Running the Code
Sample Test Class
Real World Scenaria. IDE Software
Identifying Your Weakest Link
“Overstudying” the Online Practice Exams
Applying Test-Taking Strategies
Using the Provided Writing Material
Understanding the Question
Applying the Process of Elimination
Skipping Difficult Questions
Being Suspicious of Strong Words
Choosing the Best Answer
Answer All Questions!
Getting a Good Night's Rest
Taking the Exam
Scheduling the Exam
Taking an Online Proctored Exam
The Day of the Exam
Finding Out Your Score
Objective Map
Java SE 17 Developer (1Z0-829)
Java Foundations (1Z0-811)
Assessment Test
Answers to Assessment Test
Chapter 1 Building Blocks
Learning about the Environment
Major Components of Java
Where Did the JRE Go?
Downloading a JDK
Check Your Version of Java
Understanding the Class Structure
Fields and Methods
Comments
Classes and Source Files
Writing a main() Method
Creating a main() Method
Optional Modifiers in main() Methods
Passing Parameters to a Java Program
Single-File Source-Code
Understanding Package Declarations and Imports
Packages
Wildcards
Redundant Imports
Naming Conflicts
If You Really Need to Use Two Classes with the Same Name
Creating a New Package
Compiling and Running Code with Packages
Compiling with Wildcards
Compiling to Another Directory
Three Classpath Options
Compiling with JAR Files
Creating a JAR File
Ordering Elements in a Class
Creating Objects
Calling Constructors
Reading and Writing Member Fields
Executing Instance Initializer Blocks
Following the Order of Initialization
Understanding Data Types
Using Primitive Types
The Primitive Types
Is String a Primitive?
Signed and Unsigned: short and char
Writing Literals
Literals and the Underscore Character
Using Reference Types
Distinguishing between Primitives and Reference Types
Creating Wrapper Classes
Defining Text Blocks
Declaring Variables
Identifying Identifiers
camelCase and snake_case
Declaring Multiple Variables
Initializing Variables
Creating Local Variables
Final Local Variables
Uninitialized Local Variables
Passing Constructor and Method Parameters
Defining Instance and Class Variables
Inferring the Type with var
Type Inference of var
Examples with var
Real World Scenaria. var in the Real World
Managing Variable Scope
Limiting Scope
Tracing Scope
Applying Scope to Classes
Reviewing Scope
Destroying Objects
Understanding Garbage Collection
Tracing Eligibility
Objects vs. References
Code Formatting on the Exam
Summary
Exam Essentials
Review Questions
Chapter 2 Operators
Understanding Java Operators
Types of Operators
Operator Precedence
Applying Unary Operators
Complement and Negation Operators
Increment and Decrement Operators
Working with Binary Arithmetic Operators
Arithmetic Operators
Adding Parentheses
Changing the Order of Operation
Verifying Parentheses Syntax
Division and Modulus Operators
Numeric Promotion
Numeric Promotion Rules
Assigning Values
Assignment Operator
Casting Values
Reviewing Primitive Assignments
Applying Casting
Real World Scenaria. Overflow and Underflow
Casting Values vs. Variables
Compound Assignment Operators
Return Value of Assignment Operators
Comparing Values
Equality Operators
Relational Operators
Numeric Comparison Operators
instanceof Operator
Invalid instanceof
null and the instanceof operator
Logical Operators
Conditional Operators
Avoiding a NullPointerException
Checking for Unperformed Side Effects
Making Decisions with the Ternary Operator
Ternary Expression and Unperformed Side Effects
Summary
Exam Essentials
Review Questions
Chapter 3 Making Decisions
Creating Decision-Making Statements
Statements and Blocks
The if Statement
Watch Indentation and Braces
The else Statement
Verifying That the if Statement Evaluates to a Boolean Expression
Shortening Code with Pattern Matching
Reassigning Pattern Variables
Pattern Variables and Expressions
Subtypes
Limitations of Subtype Enforcement
Flow Scoping
Flow Scoping and else Branches
Applying switch Statements
The switch Statement
Combining case Values
Exiting with break Statements
Selecting switch Data Types
Determining Acceptable Case Values
The switch Expression
Returning Consistent Data Types
Applying a case Block
Watch Semicolons in switch Expressions
Covering All Possible Values
Writing while Loops
The while Statement
The do/while Statement
Infinite Loops
Constructing for Loops
The for Loop
Real World Scenaria. Why i in for Loops?
Printing Elements in Reverse
Working with for Loops
Modifying Loop Variables
The for-each Loop
Controlling Flow with Branching
Nested Loops
Adding Optional Labels
The break Statement
The continue Statement
The return Statement
Unreachable Code
Reviewing Branching
Summary
Exam Essentials
Review Questions
Chapter 4 Core APIs
Creating and Manipulating Strings
Concatenating
Important String Methods
Determining the Length
Getting a Single Character
Finding an Index
Getting a Substring
Adjusting Case
Checking for Equality
Overriding toString(), equals(Object), and hashCode()
Searching for Substrings
Replacing Values
Removing Whitespace
Working with Indentation
Translating Escapes
Checking for Empty or Blank Strings
Formatting Values
Using format() with Flags
Method Chaining
Using the StringBuilder Class
Mutability and Chaining
Creating a StringBuilder
Important StringBuilder Methods
Using Common Methods
Appending Values
Inserting Data
Deleting Contents
Replacing Portions
Reversing
Working with toString()
Understanding Equality
Comparing equals() and ==
The String Pool
Understanding Arrays
Creating an Array of Primitives
Multiple “Arrays” in Declarations
Creating an Array with Reference Variables
Using an Array
Sorting
Searching
Comparing
Using compare()
Using mismatch()
Using Methods with Varargs
Working with Multidimensional Arrays
Creating a Multidimensional Array
Using a Multidimensional Array
Calculating with Math APIs
Finding the Minimum and Maximum
Rounding Numbers
Determining the Ceiling and Floor
Calculating Exponents
Generating Random Numbers
Working with Dates and Times
Day vs. Date
Creating Dates and Times
Wait, I Don't Live in the United States
Manipulating Dates and Times
Working with Periods
Working with Durations
ChronoUnit for Differences
Period vs. Duration
Working with Instants
Accounting for Daylight Saving Time
Summary
Exam Essentials
Review Questions
Chapter 5 Methods
Designing Methods
Access Modifiers
Optional Specifiers
Return Type
Method Name
Parameter List
Method Signature
Exception List
Method Body
Declaring Local and Instance Variables
Local Variable Modifiers
Effectively Final Variables
Effective Final Parameters
Instance Variable Modifiers
Working with Varargs
Creating Methods with Varargs
Rules for Creating a Method with a Varargs Parameter
Calling Methods with Varargs
Accessing Elements of a Vararg
Using Varargs with Other Method Parameters
Applying Access Modifiers
Private Access
Package Access
Protected Access
Public Access
Reviewing Access Modifiers
Accessing static Data
Designing static Methods and Variables
Accessing a static Variable or Method
Class vs. Instance Membership
static Variable Modifiers
static Initializers
Try to Avoid static and Instance Initializers
static Imports
Passing Data among Methods
Passing Objects
Pass-by-Value vs. Pass-by-Reference
Returning Objects
Autoboxing and Unboxing Variables
Limits of Autoboxing and Numeric Promotion
Overloading Methods
Reference Types
Primitives
Autoboxing
Arrays
Varargs
Putting It All Together
Summary
Exam Essentials
Review Questions
Chapter 6 Class Design
Understanding Inheritance
Declaring a Subclass
Class Modifiers
Single vs. Multiple Inheritance
Inheriting Object
Creating Classes
Extending a Class
Applying Class Access Modifiers
Accessing the this Reference
Calling the super Reference
Declaring Constructors
Creating a Constructor
The Default Constructor
Calling Overloaded Constructors with this()
this vs. this()
Calling Parent Constructors with super()
super vs. super()
Understanding Compiler Enhancements
Default Constructor Tips and Tricks
super() Always Refers to the Most Direct Parent
Initializing Objects
Initializing Classes
Initialize Class X
Why the Hippo Program Printed C After AB
Initializing final Fields
Initializing Instances
Initialize Instance of X
Inheriting Members
Overriding a Method
Method Overriding Infinite Calls
Rule #1: Method Signatures
Rule #2: Access Modifiers
Rule #3: Checked Exceptions
Rule #4: Covariant Return Types
Real World Scenaria. Marking Methods with the @Override Annotation
Redeclaring private Methods
Hiding Static Methods
Hiding Variables
Writing final Methods
Creating Abstract Classes
Introducing Abstract Classes
Declaring Abstract Methods
Creating a Concrete Class
Creating Constructors in Abstract Classes
Spotting Invalid Declarations
abstract and final Modifiers
abstract and private Modifiers
abstract and static Modifiers
Creating Immutable Objects
Declaring an Immutable Class
Copy on Read Accessor Methods
Performing a Defensive Copy
Summary
Exam Essentials
Review Questions
Chapter 7 Beyond Classes
Implementing Interfaces
Declaring and Using an Interface
Extending an Interface
Inheriting an Interface
Mixing Class and Interface Keywords
Inheriting Duplicate Abstract Methods
Inserting Implicit Modifiers
Conflicting Modifiers
Differences between Interfaces and Abstract Classes
Declaring Concrete Interface Methods
What About protected or Package Interface Members?
Writing a default Interface Method
Default Interface Method Definition Rules
Inheriting Duplicate default Methods
Calling a Hidden default Method
Declaring static Interface Methods
Static Interface Method Definition Rules
Reusing Code with private Interface Methods
Private Interface Method Definition Rules
Calling Abstract Methods
Reviewing Interface Members
Working with Enums
Creating Simple Enums
Calling the values(), name(), and ordinal() Methods
Calling the valueOf () Method
Using Enums in switch Statements
Adding Constructors, Fields, and Methods
Sealing Classes
Declaring a Sealed Class
Compiling Sealed Classes
Specifying the Subclass Modifier
A final Subclass
A sealed Subclass
A non-sealed Subclass
Omitting the permits Clause
Referencing Nested Subclasses
Sealing Interfaces
Reviewing Sealed Class Rules
Real World Scenaria. Why Have Sealed Classes?
Encapsulating Data with Records
Understanding Encapsulation
Applying Records
Understanding Record Immutability
Declaring Constructors
The Long Constructor
Compact Constructors
Transforming Parameters
Overloaded Constructors
Customizing Records
Creating Nested Classes
Declaring an Inner Class
Nested Classes Can Now Have static Members
Instantiating an Instance of an Inner Class
Creating .class Files for Inner Classes
Referencing Members of an Inner Class
Inner Classes Require an Instance
Creating a static Nested Class
Writing a Local Class
Why Can Local Classes Only Access final or Effectively Final Variables?
Defining an Anonymous Class
Real World Scenaria. Anonymous Classes and Lambda Expressions
Reviewing Nested Classes
Understanding Polymorphism
Object vs. Reference
Real World Scenaria. Using Interface References
Casting Objects
Disallowed Casts
Casting Interfaces
The instanceof Operator
Polymorphism and Method Overriding
Calling the Parent Version of an Overridden Method
Overriding vs. Hiding Members
Real World Scenaria. Don't Hide Members in Practice
Summary
Exam Essentials
Review Questions
Chapter 8 Lambdas and Functional Interfaces
Writing Simple Lambdas
Looking at a Lambda Example
Learning Lambda Syntax
Assigning Lambdas to var
Coding Functional Interfaces
Defining a Functional Interface
The @FunctionalInterface Annotation
Adding Object Methods
Using Method References
Calling static Methods
Calling Instance Methods on a Particular Object
Calling Instance Methods on a Parameter
Calling Constructors
Reviewing Method References
Working with Built-in Functional Interfaces
Implementing Supplier
Implementing Consumer and BiConsumer
Implementing Predicate and BiPredicate
Implementing Function and BiFunction
Implementing UnaryOperator and BinaryOperator
Checking Functional Interfaces
Using Convenience Methods on Functional Interfaces
Learning the Functional Interfaces for Primitives
Functional Interfaces for boolean
Functional Interfaces for double, int, and long
Working with Variables in Lambdas
Listing Parameters
Parameter List Formats
Using Local Variables Inside a Lambda Body
Real World Scenaria. Keep Your Lambdas Short
Referencing Variables from the Lambda Body
Summary
Exam Essentials
Review Questions
Chapter 9 Collections and Generics
Using Common Collection APIs
Using the Diamond Operator
Adding Data
Removing Data
Counting Elements
Clearing the Collection
Check Contents
Removing with Conditions
Iterating
Other Iteration Approaches
Determining Equality
Unboxing nulls
Using the List Interface
Comparing List Implementations
Creating a List with a Factory
Creating a List with a Constructor
Using var with ArrayList
Working with List Methods
Overloaded remove() Methods
Converting from List to an Array
Using the Set Interface
Comparing Set Implementations
Working with Set Methods
Using the Queue and Deque Interfaces
Comparing Deque Implementations
Working with Queue and Deque Methods
Using the Map Interface
Map.of() and Map.copyOf()
Comparing Map Implementations
Working with Map Methods
Calling Basic Methods
Iterating through a Map
Getting Values Safely
Replacing Values
Putting if Absent
Merging Data
Comparing Collection Types
Real World Scenaria. Older Collections
Sorting Data
Creating a Comparable Class
Casting the compareTo() Argument
Checking for null
Keeping compareTo() and equals() Consistent
Comparing Data with a Comparator
Is Comparable a Functional Interface?
Comparing Comparable and Comparator
Comparing Multiple Fields
Sorting and Searching
Reviewing binarySearch()
Sorting a List
Working with Generics
Creating Generic Classes
Naming Conventions for Generics
Understanding Type Erasure
Overloading a Generic Method
Returning Generic Types
Implementing Generic Interfaces
Real World Scenaria. What You Can't Do with Generic Types
Writing Generic Methods
Real World Scenaria. Optional Syntax for Invoking a Generic Method
Creating a Generic Record
Bounding Generic Types
Creating Unbounded Wildcards
Creating Upper-Bounded Wildcards
Creating Lower-Bounded Wildcards
Understanding Generic Supertypes
Putting It All Together
Combining Generic Declarations
Passing Generic Arguments
Summary
Exam Essentials
Review Questions
Chapter 10 Streams
Returning an Optional
Creating an Optional
Dealing with an Empty Optional
Is Optional the Same as null?
Using Streams
Understanding the Pipeline Flow
Creating Stream Sources
Creating Finite Streams
Creating a Parallel Stream
Creating Infinite Streams
Printing a Stream Reference
Reviewing Stream Creation Methods
Using Common Terminal Operations
Counting
Finding the Minimum and Maximum
Finding a Value
Matching
Iterating
Reducing
Collecting
Using Common Intermediate Operations
Filtering
Removing Duplicates
Restricting by Position
Mapping
Using flatMap
Concatenating Streams
Sorting
Taking a Peek
Real World Scenaria. Danger: Changing State with peek()
Putting Together the Pipeline
Working with Primitive Streams
Creating Primitive Streams
Mapping Streams
Using flatMap()
Using Optional with Primitive Streams
Summarizing Statistics
Working with Advanced Stream Pipeline Concepts
Linking Streams to the Underlying Data
Chaining Optionals
Real World Scenaria. Checked Exceptions and Functional Interfaces
Using a Spliterator
Collecting Results
Using Basic Collectors
Collecting into Maps
Grouping, Partitioning, and Mapping
Debugging Complicated Generics
Teeing Collectors
Summary
Exam Essentials
Review Questions
Chapter 11 Exceptions and Localization
Understanding Exceptions
The Role of Exceptions
Real World Scenaria. Return Codes vs. Exceptions
Understanding Exception Types
Checked Exceptions
Unchecked Exceptions
Error and Throwable
Reviewing Exception Types
Throwing an Exception
throw vs. throws
Calling Methods That Throw Exceptions
Overriding Methods with Exceptions
Printing an Exception
Recognizing Exception Classes
RuntimeException Classes
ArithmeticException
ArrayIndexOutOfBoundsException
ClassCastException
NullPointerException
Enabling/Disabling Helpful NullPointerExceptions
IllegalArgumentException
NumberFormatException
Checked Exception Classes
Error Classes
Handling Exceptions
Using try and catch Statements
Chaining catch Blocks
Applying a Multi-catch Block
Adding a finally Block
System.exit()
Automating Resource Management
Introducing Try-with-Resources
Basics of Try-with-Resources
Constructing Try-with-Resources Statements
Declaring Resources
Scope of Try-with-Resources
Following Order of Operations
Applying Effectively Final
Understanding Suppressed Exceptions
Formatting Values
Formatting Numbers
Formatting Dates and Times
Customizing the Date/Time Format
Learning the Standard Date/Time Symbols
Selecting a format() Method
Adding Custom Text Values
Supporting Internationalization and Localization
Picking a Locale
Localizing Numbers
Formatting Numbers
Parsing Numbers
Formatting with CompactNumberFormat
Localizing Dates
Specifying a Locale Category
Loading Properties with Resource Bundles
Creating a Resource Bundle
Real World Scenaria. Loading Resource Bundle Files at Runtime
Picking a Resource Bundle
Selecting Resource Bundle Values
Formatting Messages
Using the Properties Class
Summary
Exam Essentials
Review Questions
Chapter 12 Modules
Introducing Modules
Exploring a Module
Benefits of Modules
Creating and Running a Modular Program
Creating the Files
Compiling Our First Module
What about the classpath?
Real World Scenaria. Building Modules
Running Our First Module
Packaging Our First Module
Updating Our Example for Multiple Modules
Updating the Feeding Module
Creating a Care Module
Creating the Talks Module
Creating the Staff Module
Diving into the Module Declaration
Exporting a Package
Exported Types
Requiring a Module Transitively
Effects of requires transitive
Duplicate requires Statements
Opening a Package
Real World Scenaria. Opening an Entire Module
Creating a Service
Declaring the Service Provider Interface
Creating a Service Locator
Using ServiceLoader
Invoking from a Consumer
Adding a Service Provider
Reviewing Directives and Services
Discovering Modules
Identifying Built-in Modules
Getting Details with java
Describing a Module
More about Describing Modules
Listing Available Modules
Showing Module Resolution
Describing with jar
Learning about Dependencies with jdeps
Using the --jdk-internals Flag
Real World Scenaria. About sun.misc.Unsafe
Using Module Files with jmod
Creating Java Runtimes with jlink
Reviewing Command-Line Options
Comparing Types of Modules
Named Modules
Automatic Modules
About the MANIFEST.MF File
Unnamed Modules
Reviewing Module Types
Migrating an Application
Real World Scenaria. Migrating Your Applications at Work
Determining the Order
Exploring a Bottom-Up Migration Strategy
Exploring a Top-Down Migration Strategy
Splitting a Big Project into Modules
Failing to Compile with a Cyclic Dependency
Summary
Exam Essentials
Review Questions
Chapter 13 Concurrency
Introducing Threads
Understanding Thread Concurrency
Creating a Thread
Calling run() Instead of start()
Distinguishing Thread Types
Managing a Thread's Life Cycle
Polling with Sleep
Interrupting a Thread
Creating Threads with the Concurrency API
Introducing the Single-Thread Executor
Shutting Down a Thread Executor
Submitting Tasks
Submitting Tasks: execute() vs. submit()
Waiting for Results
Introducing Callable
Waiting for All Tasks to Finish
Scheduling Tasks
Increasing Concurrency with Pools
Writing Thread-Safe Code
Understanding Thread-Safety
Accessing Data with volatile
Protecting Data with Atomic Classes
Improving Access with synchronized Blocks
Synchronizing on Methods
Understanding the Lock Framework
Applying a ReentrantLock
Attempting to Acquire a Lock
tryLock()
tryLock(long,TimeUnit)
Acquiring the Same Lock Twice
Reviewing the Lock Framework
Orchestrating Tasks with a CyclicBarrier
Reusing CyclicBarrier
Using Concurrent Collections
Understanding Memory Consistency Errors
Working with Concurrent Classes
Obtaining Synchronized Collections
Identifying Threading Problems
Understanding Liveness
Deadlock
Starvation
Livelock
Managing Race Conditions
Working with Parallel Streams
Creating Parallel Streams
Performing a Parallel Decomposition
Ordering Results
Processing Parallel Reductions
Performing Order-Based Tasks
Real World Scenaria. Creating Unordered Streams
Combining Results with reduce()
Selecting a reduce() Method
Combining Results with collect()
Performing a Parallel Reduction on a Collector
Real World Scenaria. Avoiding Stateful Streams
Summary
Exam Essentials
Review Questions
Chapter 14 I/O
Referencing Files and Directories
Conceptualizing the File System
Operating System File Separators
Creating a File or Path
Creating a File
Creating a Path
Switching between File and Path
Obtaining a Path from the FileSystems Class
Reviewing I/O and NIO.2 Relationships
Operating on File and Path
Using Shared Functionality
Closing the Stream
Handling Methods That Declare IOException
Providing NIO.2 Optional Parameters
Interacting with NIO.2 Paths
Viewing the Path
Creating Part of the Path
Accessing Path Elements
Resolving Paths
Relativizing a Path
Normalizing a Path
Retrieving the Real File System Path
Reviewing NIO.2 Path APIs
Creating, Moving, and Deleting Files and Directories
Making Directories
Copying Files
Copying and Replacing Files
Copying Files with I/O Streams
Copying Files into a Directory
Moving or Renaming Paths with move()
Similarities between move() and copy()
Performing an Atomic Move
Deleting a File with delete() and deleteIfExists()
Comparing Files with isSameFile() and mismatch()
Introducing I/O Streams
Understanding I/O Stream Fundamentals
I/O Streams Can Be Big
Learning I/O Stream Nomenclature
Storing Data as Bytes
Byte Streams vs. Character Streams
Character Encoding in Java
Input vs. Output Streams
Low-Level vs. High-Level Streams
Stream Base Classes
Decoding I/O Class Names
Reading and Writing Files
Using I/O Streams
Enhancing with Files
Files.readAllLines() vs. Files.lines()
Combining with newBufferedReader() and newBufferedWriter()
Reviewing Common Read and Write Methods
Serializing Data
Applying the Serializable Interface
Real World Scenaria. Maintaining a serialVersionUID
Marking Data transient
Ensuring That a Class Is Serializable
Serializing Records
Storing Data with ObjectOutputStream and ObjectInputStream
Understanding the Deserialization Creation Process
Interacting with Users
Printing Data to the User
Real World Scenaria. Using Logging APIs
Reading Input as an I/O Stream
Closing System Streams
Acquiring Input with Console
Obtaining Underlying I/O Streams
Formatting Console Data
Using Console with a Locale
Reading Console Data
Reviewing Console Methods
Working with Advanced APIs
Manipulating Input Streams
Marking Data
Skipping Data
Reviewing Manipulation APIs
Discovering File Attributes
Checking for Symbolic Links
Checking File Accessibility
Improving Attribute Access
Understanding Attribute and View Types
Retrieving Attributes
Modifying Attributes
Traversing a Directory Tree
Don't Use DirectoryStream and FileVisitor
Selecting a Search Strategy
Walking a Directory
Applying a Depth Limit
Avoiding Circular Paths
Searching a Directory
Review of Key APIs
Summary
Exam Essentials
Review Questions
Chapter 15 JDBC
For Experienced Developers
Introducing Relational Databases and SQL
Running the Examples in the Chapter
Identifying the Structure of a Relational Database
Writing Basic SQL Statements
Introducing the Interfaces of JDBC
Compiling with Modules
Connecting to a Database
Building a JDBC URL
Getting a Database Connection
Working with a PreparedStatement
Little Bobby Tables
Obtaining a PreparedStatement
Executing a PreparedStatement
Modifying Data with executeUpdate()
Reading Data with executeQuery()
Processing Data with execute()
Using the Correct Method
Reviewing PreparedStatement Methods
Working with Parameters
Updating Multiple Records
Real World Scenaria. Batching Statements
Getting Data from a ResultSet
Reading a ResultSet
Getting Data for a Column
Using Bind Variables
Calling a CallableStatement
Calling a Procedure without Parameters
Passing an IN Parameter
Returning an OUT Parameter
Database-Specific Behavior
Working with an INOUT Parameter
Comparing Callable Statement Parameters
Using Additional Options
Controlling Data with Transactions
Committing and Rolling Back
Autocommit Edge Cases
Bookmarking with Savepoints
Reviewing Transaction APIs
Closing Database Resources
Writing a Resource Leak
Real World Scenaria. Dealing with Exceptions
Summary
Exam Essentials
Review Questions
Appendix Answers to the Review Questions
Chapter 1: Building Blocks
Chapter 2: Operators
Chapter 3: Making Decisions
Chapter 4: Core APIs
Chapter 5: Methods
Chapter 6: Class Design
Chapter 7: Beyond Classes
Chapter 8: Lambdas and Functional Interfaces
Chapter 9: Collections and Generics
Chapter 10: Streams
Chapter 11: Exceptions and Localization
Chapter 12: Modules
Chapter 13: Concurrency
Chapter 14: I/O
Chapter 15: JDBC
Index. A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
Y
Online Test Bank
Register and Access the Online Test Bank
WILEY END USER LICENSE AGREEMENT
Отрывок из книги
Scott Selikoff
Jeanne Boyarsky
.....
You should expect to see a question about initialization on the exam. Let's try one more. What do you think this code prints out?
public class Egg { public Egg() { number = 5; } public static void main(String[] args) { Egg egg = new Egg(); System.out.println(egg.number); } private int number = 3; { number = 4; } }
.....