Ôn tập Lập trình hướng đối tượng bằng ngôn ngữ Java
- Introduction
- Identifiers
- Variables
- Assignment Statements and Assignment Expressions
- Named Constants
- Naming Conventions
- Numeric Data Types and Operations
- Numeric Literals
- Evaluating Expressions and Operator Precedence
- Augmented Assignment Operators
- Increment and Decrement Operators
- Numeric Type Conversions
- Common Errors and Pitfalls
- Introduction
- Boolean Data Type
- if Statements
- Two-Way if-else Statements
- Nested if and Multi-Way if-else Statements
- Common Errors and Pitfalls
- Generating Random Numbers
- Case Study: Computing Body Mass Index
- Case Study: Computing Taxes
- Logical Operators
- Case Study: Determining Leap Year
- Case Study: Lottery
- switch Statements
- Conditional Operators
- Operator Precedence and Associativity
- Debugging
- Introduction
- Common Mathematical Functions
- Character Data Type and Operations
- The String Type
- Case Studies
- Formatting Console Output
- Introduction
- The while Loop
- Case Study: Guessing Numbers
- Loop Design Strategies
- Controlling a Loop with User Confirmation or a Sentinel Value
- The do-while Loop
- The for Loop
- Which Loop to Use?
- Nested Loops
- Minimizing Numeric Errors
- Case Studies
- Keywords break and continue
- Case Study: Checking Palindromes
- Case Study: Displaying Prime Numbers
- Introduction
- Defining a Method
- Calling a Method
- void vs. Value-Returning Methods
- Passing Parameters by Values
- Modularizing Code
- Case Study: Converting Hexadecimals to Decimals
- Overloading Methods
- The Scope of Variables
- Case Study: Generating Random Characters
- Method Abstraction and Stepwise Refinement
- Introduction
- Array Basics
- Case Study: Analyzing Numbers
- Case Study: Deck of Cards
- Copying Arrays
- Passing Arrays to Methods
- Returning an Array from a Method
- Case Study: Counting the Occurrences of Each Letter
- Variable-Length Argument Lists
- Searching Arrays
- Sorting Arrays
- The Arrays Class
- Command-Line Arguments
- Introduction
- Two-Dimensional Array Basics
- Processing Two-Dimensional Arrays
- Passing Two-Dimensional Arrays to Methods
- Case Study: Grading a Multiple-Choice Test
- Case Study: Finding the Closest Pair
- Case Study: Sudoku
- Multidimensional Arrays
- Introduction
- Defining Classes for Objects
- Example: Defining Classes and Creating Objects
- Constructing Objects Using Constructors
- Accessing Objects via Reference Variables
- Using Classes from the Java Library
- Static Variables, Constants, and Methods
- Visibility Modifiers
- Data Field Encapsulation
- Passing Objects to Methods
- Array of Objects
- Immutable Objects and Classes
- The Scope of Variables
- The this Reference
- Introduction
- Class Abstraction and Encapsulation
- Thinking in Objects
- Class Relationships
- Case Study: Designing the Course Class
- Case Study: Designing a Class for Stacks
- Processing Primitive Data Type Values as Objects
- Automatic Conversion between Primitive Types and Wrapper Class Types
- The BigInteger and BigDecimal Classes
- The String Class
- The StringBuilder and StringBuffer Classes
- Introduction
- Superclasses and Subclasses
- Using the super Keyword
- Overriding Methods
- Overriding vs. Overloading
- The Object Class and Its toString() Method
- Polymorphism
- Dynamic Binding
- Casting Objects and the instanceof Operator
- The Object’s equals Method
- The ArrayList Class
- Useful Methods for Lists
- Case Study: A Custom Stack Class
- The protected Data and Methods
- Preventing Extending and Overriding
- Introduction
- Exception-Handling Overview
- Exception Types
- More on Exception Handling
- The finally Clause
- When to Use Exceptions
- Rethrowing Exceptions
- Chained Exceptions
- Defining Custom Exception Classes
- The File Class
- File Input and Output
- Reading Data from the Web
- Case Study: Web Crawler
- Introduction
- Abstract Classes
- Case Study: the Abstract Number Class
- Case Study: Calendar and GregorianCalendar
- Interfaces
- The Comparable Interface
- The Cloneable Interface
- Interfaces vs. Abstract Classes
- Case Study: The Rational Class
- Class-Design Guidelines