Professional Documents
Culture Documents
o What Is an Object?
o What Is a Class?
o What Is Inheritance?
o What Is an Interface?
o What Is a Package?
o Questions and Exercises: Object-Oriented Programming Concepts
Language Basics
o Variables
Primitive Data Types
Arrays
Summary of Variables
o Questions and Exercises: Variables
o Operators
Assignment, Arithmetic, and Unary Operators
Equality, Relational, and Conditional Operators
Bitwise and Bit Shift Operators
Summary of Operators
o Questions and Exercises: Operators
o Expressions, Statements, and Blocks
o Questions and Exercises: Expressions, Statements, and Blocks
o Control Flow Statements
The if-then and if-then-else Statements
The switch Statement
The while and do-while Statements
The for Statement
Branching Statements
Summary of Control Flow Statements
o Questions and Exercises: Control Flow Statements
Classes and Objects
o Classes
Declaring Classes
Declaring Member Variables
Defining Methods
Providing Constructors for Your Classes
Passing Information to a Method or a Constructor
o Objects
Creating Objects
Using Objects
o More on Classes
Returning a Value from a Method
Using the this Keyword
Controlling Access to Members of a Class
Understanding Class Members
Initializing Fields
Summary of Creating and Using Classes and Objects
o Questions and Exercises: Classes
o Questions and Exercises: Objects
o Nested Classes
Inner Class Example
Local Classes
Anonymous Classes
Lambda Expressions
Method References
When to Use Nested Classes, Local Classes, Anonymous Classes, and Lambda
Expressions
o Questions and Exercises: Nested Classes
o Enum Types
o Questions and Exercises: Enum Types
Annotations
o Annotations Basics
o Declaring an Annotation Type
o Predefined Annotation Types
o Type Annotations and Pluggable Type Systems
o Repeating Annotations
o Questions and Exercises: Annotations
Interfaces and Inheritance
o Interfaces
Defining an Interface
Implementing an Interface
Using an Interface as a Type
Evolving Interfaces
Default Methods
Summary of Interfaces
o Questions and Exercises: Interfaces
o Inheritance
Multiple Inheritance of State, Implementation, and Type
Overriding and Hiding Methods
Polymorphism
Hiding Fields
Using the Keyword super
Object as a Superclass
Writing Final Classes and Methods
Abstract Methods and Classes
Summary of Inheritance
o Questions and Exercises: Inheritance
Numbers and Strings
o Numbers
The Numbers Classes
Formatting Numeric Print Output
Beyond Basic Arithmetic
Summary of Numbers
o Questions and Exercises: Numbers
o Characters
o Strings
Converting Between Numbers and Strings
Manipulating Characters in a String
Comparing Strings and Portions of Strings
The StringBuilder Class
Summary of Characters and Strings
o Autoboxing and Unboxing
o Questions and Exercises: Characters and Strings
Generics (Updated)
o Why Use Generics?
o Generic Types
Raw Types
o Generic Methods
o Bounded Type Parameters
Generic Methods and Bounded Type Parameters
o Generics, Inheritance, and Subtypes
o Type Inference
o Wildcards
Upper Bounded Wildcards
Unbounded Wildcards
Lower Bounded Wildcards
Wildcards and Subtyping
Wildcard Capture and Helper Methods
Guidelines for Wildcard Use
o Type Erasure
Erasure of Generic Types
Erasure of Generic Methods
Effects of Type Erasure and Bridge Methods
Non-Reifiable Types
o Restrictions on Generics
o Questions and Exercises: Generics
Packages
o Creating and Using Packages
Creating a Package
Naming a Package
Using Package Members
Managing Source and Class Files
Summary of Creating and Using Packages
o Questions and Exercises: Creating and Using Packages