|
1. Introduction to Java
1.1 Object-oriented
1.2 Platform-independent
2. Anatomy of a Java Program
3. “Hello World” for the NetBeans IDE
3.1 Create an IDE Project
3.2 Add Code to the Generated Source File
3.3 Compile Source File into Bytecode File
3.4 Run the Program
4. “Hello World” for Mirosoft Windows (without IDE)
4.1 Create a Source File
4.2 Compile Source File into Bytecode File
4.3 Run the Program
5. Statements, Expressions and Blocks
5.1 Statements
5.2 Expressions
5.3 Blocks
6. Variables and Data Types
6.1 The Boolean Literals
6.2 Reserved Words / Keywords
6.3 Data Types
6.4 Literals
6.4.1 The Boolean Literals
6.4.2 The Character Literals
6.4.3 The Integer Literals
6.4.4 The Floating-Point Literals
6.5 Declaring and Initializing a Variable
6.6 Scope of Variables
7. Operators
7.1 Arithmetic Operators
7.1.1 Binary (二元) arithmetic operators
7.1.2 Unary (單元) arithmetic operators
7.2 Relational Operators
7.3 Conditional Operators
7.4 Logical Operators
7.4.1 Short-Circuit Logical Operators “&&” and “||”
7.4.2 Non-Short-Circuit Logical Operators “&” and “|”
7.5 Assignment Operators
8. Conversions
8.1 Widening Conversion
8.2 Narrowing Conversion
8.3 Special Notes for Conversions
8.3.1 From Numeric “int” value to either “byte” or “short”
8.3.2 Numeric Promotion in Arithmetic Expressions
8.3.3 Arithmetic Expression with Two or More Operands
8.3.4 Implicit Narrowing Conversion
9. Array
9.1 Declaring an Array
9.1.1 Declaring an Array of Primitives
9.1.2 Declaring an Array of Object References
9.1.3 Multidimensional Arrays
9.2 Constructing an Array
9.2.1 Constructing One-Dimensional Arrays
9.2.2 Constructing Multidimensional Arrays
9.3 Initializing an Array
9.4 Shortcut 1 : Combining Declaring, Constructing, and Initializing
9.5 Shortcut 2 : Anonymous Array
10. Flow Control
10.1 Selection
10.1.1 The if Statement
10.1.2 The if-else Statement
10.1.3 The switch Statement
10.2 Iteration
10.2.1 The while Statement
10.2.2 The do-while Statement
10.2.3 The for Statement
10.3 Branch
10.3.1 The break Statement
10.3.2 The continue Statement
10.3.3 The return Statement
11. Classes
11.1 Elements of a class
11.1.1 Class Declaration
11.1.2 Member Variables
11.1.3 Constructors
11.1.4 Methods
11.2 Class for simple Java Application
11.3 Creating and Working with an Object from a Class
11.3.1 Creating an Object from a Class
11.3.2 Working with the Variables inside an Object
11.3.3 Working with the Method inside an Object
11.4 Variable Type: Instance, Static and Local
11.4.1 Instance Variables
11.4.2 Static Variables
11.4.3 Local Variables
11.5 Understanding Parameters of Methods and Constructors
11.5.1 Parameterized Methods
11.5.2 Parameterized Constructors
11.5.3 Pass by-value or Pass by-reference
11.6 Understanding the “this” keyword
11.6.1 Instance Variable Hiding
11.7 “static” Revisited
12. Inheritance
12.1 Inheritance Basics
12.2 Overriding Member Variables
12.3 Overriding Methods
12.4 Using “super”
12.5 Understanding Final Classes and Methods
12.5.1 Final Classes
12.5.2 Final Methods
12.6 Understanding Abstract Classes and Methods
12.6.1 Abstract Classes
12.6.2 Abstract Methods
12.7 Understanding the “Object” class
12.8 Is-a or Has-a
12.8.1 Using the “instanceof” operator
12.8.2 IS-A
12.8.3 HAS-A
13. Interface
13.1 Defining an Interface
13.2 Creating Interface Body
13.3 Implementing an Interface
13.4 Using an Interface as a Type
13.5 Rewriting Interfaces
14. Polymorphism
15. Assertions
15.1 Using Assertions
15.2 Compile with Assertions
15.3 Run with Assertions
15.3.1 Enabling Assertions at Runtime
15.3.2 Disabling Assertions at Runtime
15.4 Using Assertions Appropriately
15.4.1 Do NOT Use Assertions to Validate Arguments to a Public Method
15.4.2 Do Use Assertions to Validate Arguments to a Private Method
15.4.3 Do Use Assertions to Check for Cases that are Never Happened
15.4.4 Do NOT Use Assert Expressions that can Cause Side Effects
16. Exception Handling
16.1 Exception Handling Basics
16.2 Example of the Occurrence of an Exception
16.3 Throwable Class
16.4 try ... catch ... finally Statement
16.4.1 try statement
16.4.2 catch statement
16.4.3 finally statement
16.4.4 Examples
16.5 Program Flow during Catching of Exception
16.5.1 Catching Exception for Statements
16.5.2 Catching Exception for Methods
16.6 Checked Exceptions
16.7 Specifying Exceptions in Method Declaration
16.8 Throwing Exceptions
16.9 Writing Custom Exception
17. Packages
17.1 Creating a Package
17.2 Using Package Members
17.2.1 Referring to a Package Member by its Fully Qualified Name
17.2.2 Importing a Package Member
17.2.3 Importing an Entire Package
17.3 Understanding Static Import
18. Access Modifier
19. Nested Classes
19.1 Inner Class
19.1.1 Importing a Package Member
19.2 Anonymous (無名的) Inner Class
19.3 Static Nested Class
20. More about Object Orientation
20.1 Overriding
20.2 Overloading
20.3 Return Type Declaration and Covariant Returns
20.4 More about Constructors
20.4.1 Default Constructor
20.4.2 Constructor with Arguments
20.4.3 Constructor Overloading
20.4.4 Method having the same name as the Class
20.4.5 Specifying Constructor of the Super Class
20.5 Using Variable-Length Argument List
20.6 Using Enums
20.7 Cohesion (內聚) and Coupling (聯結)
21. Garbage Collection
21.1 Examples of Objects Eligible for Garbage Collection
21.1.1 Local Variables
21.1.2 Assigning Null Value to an Object Variables
21.2 Garbage Collector
21.3 Finalizer
22. Threads
22.1 Introduction to Threads (線程)
22.1.1 Background
22.1.2 Explanation of Threads
22.2 Configuring Threads with Thread Class
22.3 Configuring Threads with Runnable Interface
22.4 An Example of Using Threads
22.5 Variations in Writing Programs with Thread
22.5.1 Names for Threads
22.5.2 Ways in Creating Threads for Classes implementing Runnable Interface
22.5.3 Using “new Thread(<runnable>)” for Classes Extending Thread Class
22.5.4 Using the “run( )” method of Classes for Threads
22.5.5 Summary of Using Threads
22.6 Lifetime of a Thread
22.6.1 isAlive()
22.6.2 join()
22.7 Thread Priorities
22.7.1 Setting the Priority of Threads
22.7.2 yield (被迫放棄)
22.7.3 sleep( )
22.7.4 Modifying the Priority during Thread Execution
22.8 Synchronizing (同步) Threads
22.9 wait( ) and notify( )
23. Wrapper Classes and Boxing
23.1 Overview of Wrapper Classes
23.2 Creating Wrapper Objects
23.2.1 By Constructors (using String or primitive as argument)
23.2.2 By valueOf( ) Methods (using String or primitive as argument)
23.3 Using Utilities of Wrapper Classes
23.3.1 xxxValue( )
23.3.2 parseXxx( )
23.3.3 toString( )
23.4 Autoboxing
24. Generics
24.1 Using Generics
24.2 Generics Types with Wildcards
25. Collections
25.1 Sets
25.1.1 HashSet
25.1.2 TreeSet
25.2 Lists
25.2.1 ArrayList
25.3 Maps
25.3.1 HashMap
25.3.2 TreeMap
25.4 Other Special Collections
26. Working with Files, Input and Output
26.1 Operations of Files and Directories
26.2 Working with Files
26.3 Working with Directories
26.4 Working with Byte Streams
26.5 Working with Character Streams
26.6 Working with Higher Level I/O Classes
26.7 Understanding Buffered Streams
26.7.1 flush( )
26.8 Understanding Scanning
26.9 Understanding Serialization
26.10 Console Input
27. Formatting
27.1 print( ) and println( )
27.2 printf( ) and format( )
27.3 DateFormat
27.4 StringBuilder
|