售 价:¥
温馨提示:数字商品不支持退换货,不提供源文件,不支持导出打印
为你推荐
Preface
About the Book
About the Authors
Objectives
Audience
Approach
Hardware Requirements
Software Requirements
Installation and Setup
Conventions
Installing the Code Bundle
Additional Resources
Chapter 1
Introduction to Java
Introduction
The Java Ecosystem
Our First Java Application
Syntax of a Simple Java Program
Exercise 1: A Simple Hello World Program
Exercise 2: A Simple Program for Performing Simple Mathematic Operations
Exercise 3: Displaying Non-ASCII Characters
Activity 1: Printing the Results of Simple Arithmetic Operations
Getting Input from the User
Exercise 4: Reading Values from the User and Performing Operations
Packages
Rules to Follow When Using Packages
Activity 2: Reading Values from the User and Performing Operations Using the Scanner Class
Activity 3: Calculating the Percent Increase or Decrease of Financial Instruments
Summary
Chpater 2
Variables, Data Types, and Operators
Introduction
Variables and Data Types
Variables
Reserved Keywords
Integral Data Types
int Data Type
long Data Type
Type Casting
Exercise 5: Type Casting
byte Data Type
short Data Type
Boolean Data Type
char Data Type
Floating-Point Data Types
float Data Type
double Data Type
Activity 4: Inputting Student Information and Outputting an ID
Activity 5: Calculating the Number of Full Fruit Boxes
Summary
Chapter 3
Control Flow
Introduction
Conditional Statements
The if Statement
The else Statement
Exercise 6: Implementing a Simple if-else Statement
The else-if Statement
Exercise 7: Implementing the else-if Statements
Nested if Statements
switch case Statements
Activity 6: Controlling the Flow of Execution Using Conditionals
Activity 7: Developing a Temperature System
Looping Constructs
for Loops
Exercise 8: Implementing a Simple for Loop
Activity 8: Implementing the for Loop
Nested for Loops
Exercise 9: Implementing a Nested for Loop
for-each Loops
The while and do while Loops
Exercise 10: Implementing the while Loop
Activity 9: Implementing the while Loop
Activity 10: Implementing Looping Constructs
Activity 11: Continuous Peach Shipment with Nested Loops.
Summary
Chapter 4
Object-Oriented Programming
Introduction
Object-Oriented Principles
Classes and Objects
Object-Oriented Programming
Naming Conventions for Class Names
Exercise 11: Working with Classes and Objects
Exercise 12: Using the Person Class
Constructors
The this Keyword
Activity 12: Creating a Simple Class in Java
Activity 13: Writing a Calculator Class
Inheritance
Types of Inheritance
Importance of Inheritance in OOP
Implementing Inheritance in Java
Activity 14: Creating a Calculator Using Inheritance
Overloading
Constructor Overloading
Polymorphism and Overriding
The Difference between Overriding and Overloading
Annotations
Creating Your Own Annotation Types
References
Activity 15: Understanding Inheritance and Polymorphism in Java
Summary
Chapter 5
OOP in Depth
Introduction
Interfaces
Use Case: Listeners
Exercise 13: Implementing Interfaces
Activity 16: Creating and Implementing Interfaces in Java
Typecasting
Activity 17: Using instanceof and Typecasting
The Object Class
Autoboxing and Unboxing
Activity 18: Understanding Typecasting in Java
Abstract Classes and Methods
Activity 19: Implementing Abstract Classes and Methods in Java
Activity 20: Use abstract class to Encapsulate Common Logic
Summary
Chapter 6
Data Structures, Arrays, and Strings
Introduction
Data Structures and Algorithms
Arrays
Creating and Initializing an Array
Accessing Elements
Exercise 14: Creating an Array Using a Loop
Exercise 15: Searching for a Number in an Array
Activity 21: Finding the Smallest Number in an Array
Activity 22: Calculator with Array of Operators
Two-Dimensional Arrays
Exercise 16: Printing a Simple Two-Dimensional Array
Exercise 17: Creating a Three-Dimensional Array
The Arrays Class in Java
Insertion sort
Example
Exercise 18: Implementing Insertion Sort
Creating an ArrayList and Adding Elements
Replacing and Removing Elements
Exercise 19: Adding, Removing, and Replacing Elements in an Array
Iterators
Exercise 20: Iterating through an ArrayList
Activity 23: Working with ArrayList
Strings
Creating a String
Concatenation
String Length and Characters
Activity 24: Input a String and Output Its Length and as an Array
Activity 25: Calculator Reads from Input
Conversion
Comparing Strings and Parts of Strings
StringBuilder
Exercise 21: Working with StringBuilder
Activity 26: Removing Duplicate Characters from a String
Summary
Chapter 7
The Java Collections Framework and Generics
Introduction
Reading Data from Files
Binary versus Text Files
CSV Files
Reading Files in Java
Exercise 22: Reading a CSV File
Building a CSV Reader
Exercise 23: Building a CSV Reader
Arrays
Exercise 24: Reading Users from a CSV File into an Array
Activity 27: Read Users from CSV Using Array with Initial Capacity
The Java Collections Framework
Vectors
Exercise 25: Reading Users from a CSV File into a Vector
Activity 28: Reading a Real Dataset Using Vector
Iterating over Collections
Activity 29: Iterating on a Vector of Users
Hashtable
Exercise 26: Writing an Application that Finds a User by Email
Activity 30: Using a Hashtable to Group Data
Generics
What was the Problem?
How to Use Generics
Exercise 27: Finding a User by Text in a Name or Email
Sorting and Comparing
Comparables and Comparators
Exercise 28: Creating a Comparator that Compares Strings Alphabetically
Sorting
Bubble Sort
Merge Sort
Activity 31: Sorting Users
Data Structures
Collection
List
ArrayList
LinkedList
Map
HashMap
TreeMap
LinkedHashMap
Set
HashSet
TreeSet
LinkedHashSet
Exercise 29: Using TreeSet to Print Sorted Users
Queue
java.util.ArrayDeque
java.util.PriorityQueue
Exercise 30: Fake Email Sender
Properties of Collections
Summary
Chapter 8
Advanced Data Structures in Java
Introduction
Implementing a Custom Linked List
Disadvantages of ArrayList
Advantages of Linked List over Arrays
Exercise 31: Adding Elements to a Linked list
Activity 32: Creating a Custom Linked List in Java
Drawbacks of Linked List
Implementing Binary Search Tree
Exercise 32: Creating a Binary Search Tree in Java
Activity 33: Implementing the Methods in the BinarySearchTree Class to Find the Highest and Lowest Value in the BST
Enumerations
Exercise 33: Using Enum to Store Directions
Activity 34: Using an Enum to Hold College Department Details
Activity 35: Implementing Reverse Lookup
Set and Uniqueness in Set
Basic Rules for the equals() and hashCode() Methods
Adding an Object to a Set
Exercise 34: Understanding the Behavior of equals() and hashCode()
Exercise 35: Overriding equals() and hashCode()
Summary
Chapter 9
Exception Handling
Introduction
Motivation behind Exceptions
Exercise 36: Introducing Exceptions
An Inevitable Introduction to Exceptions
Exercise 37: Using an IDE to Generate Exception-Handling Code
Exceptions versus Error Codes
Exercise 38: Exceptions Versus Error Codes
Activity 36: Handling Mistakes in Numeric User Input
Exception Sources
Checked Exceptions
Throwing a Checked Exception
Exercise 39: Working with catch or Specify
Unchecked Exceptions
Exercise 40: Using Methods That Throw Unchecked Exceptions
Exception Class Hierarchy
Browsing the Exception Hierarchy
Throwing Exceptions and Custom Exceptions
Exercise 41: Throwing an Exception
Exercise 42: Creating Custom Exception Classes
Activity 37: Writing Custom Exceptions in Java.
Exception Mechanics
How try/catch Works
Exercise 43: Exception Not Caught Because It Cannot Be Assigned to a Parameter in the catch Block
Exercise 44: Multiple catch Blocks and Their Order
Exercise 45: Exception Propagation
Multiple Exception Types in One Block
Activity 38: Dealing with Multiple Exceptions in a Block
What Are We Supposed to Do in a Catch Block?
Exercise 46: Chained Exceptions
finally Block and Their Mechanics
Exercise 47: Leaving a File Open as a Result of an Exception
Activity 39: Working with Multiple Custom Exceptions
The try with resource Block
Exercise 48: try with resources Block
Best Practices
Suppressing Exceptions
Exercise 49: Suppressing Exceptions
Keeping the User in the Loop
Exercise 50: Asking the User for Help
Do Not Throw Unless It Is Expected
Consider Chaining and Being More Specific When You Let Exceptions Propagate
Summary
Appendix
Lesson 1: Introduction to Java
Activity 1: Printing the Results of Simple Arithmetic Operations
Activity 2: Reading Values from the User and Performing Operations Using the Scanner Class.
Activity 3: Calculating the Percent Increase or Decrease of Financial Instruments
Lesson 2: Variables, Data Types, and Operators
Activity 4: Inputting Student Information and Outputting an ID
Activity 5: Calculating the Number of Full Fruit Boxes
Lesson 3: Control Flow
Activity 6: Controlling the Flow of Execution Using Conditionals
Activity 7: Developing a Temperature System
Activity 8: Implementing the for Loop
Activity 9: Implementing the while Loop
Activity 10: Implementing Looping Constructs
Activity 11: Continuous Peach Shipment with Nested Loops
Lesson 4: Object-Oriented Programming
Activity 12: Creating a Simple Class in Java
Activity 13: Writing a Calculator Class
Activity 14: Creating a Calculator Using Java
Activity 15: Understanding Inheritance and Polymorphism in Java
Lesson 5: OOP in Depth
Activity 16: Creating and Implementing Interfaces in Java
Activity 17: Using instanceof and Typecasting
Activity 18: Understanding Typecasting in Java
Activity 19: Implementing Abstract Classes and Methods in Java
Activity 20: Use abstract class to Encapsulate Common Logic
Lesson 6: Data Structures, Arrays, and Strings
Activity 21: Finding the Smallest Number in an Array
Activity 22: Calculator with Array of Operators
Activity 23: Working with ArrayList
Activity 24: Input a String and Output Its Length and as an Array
Activity 25: Calculator Reads from Input
Activity 26: Removing Duplicate Characters from a String
Lesson 7: The Java Collections Framework and Generics
Activity 27: Read Users from CSV Using Array with Initial Capacity
Activity 28: Reading a Real Dataset Using Vector
Activity 29: Iterating on Vector of Users
Activity 30: Using a Hashtable to Group Data
Activity 31: Sorting Users
Lesson 8: Advanced Data Structures in Java
Activity 32: Creating a Custom Linked List in Java
Activity 33: Implementing the Methods in the BinarySearchTree Class to Find the Highest and Lowest Value in the BST
Activity 34: Using an Enum to Hold College Department Details
Activity 35: Implementing Reverse Lookup
Lesson 9: Exception Handling
Activity 36: Handling Mistakes in Numeric User Input
Activity 37: Writing Custom Exceptions in Java
Activity 38: Dealing with Multiple Exceptions in a Block
Activity 39: Working with Multiple Custom Exceptions
买过这本书的人还买过
读了这本书的人还在读
同类图书排行榜