Java Rules (Paperback)

Douglas Dunn

  • 出版商: Addison Wesley
  • 出版日期: 2001-10-10
  • 定價: $1,500
  • 售價: 2.7$399
  • 語言: 英文
  • 頁數: 720
  • 裝訂: Paperback
  • ISBN: 0201709163
  • ISBN-13: 9780201709162
  • 相關分類: Java 程式語言
  • 立即出貨(限量) (庫存=10)



Detailed yet accessible, Java™ Rules is a comprehensive reference for the application programmer who needs to master the intricacies of the Java™ programming language. Thoroughly describing the core of the Java programming language and the Java™ virtual machine (JVM™), Java™ Rules makes it possible for programmers to efficiently master the Java platform.

Based on the second editions of The Java™ Language Specification and The Java™ Virtual Machine Specification, Java™ Rules presents a subset of those specifications in a gentle tutorial style. From platform basics to APIs, this encyclopedic guidebook reveals every facet of the language--including previously undocumented features. Throughout the book, practical tutorials are supported with official language documentation or with insights shared by respected leaders. The book's unique format and conversational style are ideally suited for experienced programmers seeking a short path to language proficiency.

As both a tutorial and detailed reference, this volume of Java™ Rules covers:

  • Lexical structure, escape sequences, and positional notation systems
  • The anatomy of a compilation unit
  • The five kinds of classes and interfaces
  • Containment and inner class hierarchies (versus inheritance hierarchies)
  • The static modifier, this and super
  • Primitive data types and Object
  • Strings and other common data types
  • Arrays and the Collections Framework

With Java™ Rules in hand, both novices and experienced programmers can quickly master the language.

Table of Contents

About This Book.
A Java Tradition.
1. Lexical Structure.

White Space.

Commenting Out Large Blocks of Code.

Java Naming Conventions.

Character Literals.
Escape Sequences.
String Literals.
Numeric Literals.
Class Literals.


2. Compilation Units.

The Terminology of Class Body Declarations.
The Definition of Fields in Java.
Recognizing Constructors in Source Code.

Anatomy of a Compilation Unit.
Special Initialization Methods.
The Significance of Textual Order.
Limit of One “public” Package Member.

Package Declarations.
Package Names.
The Members of a Package.
Using the SDK to Develop Packages.

Import Declarations.
Automatic Imports.
Redundant Imports.
Importing Nested Classes of All Sorts (Top-Level or Inner).
How Import Declarations are Used by a Compiler.
The Efficiency of Type-Import-on-Demand Declarations.

Type Declarations.
Class Type Declarations.
Interface Type Declarations.

The Definition of Top-Level Classes.
Helper Classes are Not Fundamentally Different.
Technical Arguments Against the Use of Helper Classes.

The Five Kinds of Classes and Interfaces.
“Public” Top-Level Classes.
Non-“public” Member Classes.
Local and Anonymous Classes.
Nested Interfaces.

Choosing Which Kind of Class to Use.
From “VectorEnumerator” to an Anonymous Class.

The Rationale for Containment and Inner Class Hierarchies.
Containment and Inner Class Hierarchies.
Containment Hierarchies.
Inner Class Hierarchies.

3. The “static” Modifier, “this,” and “super” .

The “static” Modifier.
“static” Fields.
“static” Methods.
“static” Classes.

The Definition of “static” Context.
The “static” Context in an Inner Class Hierarchy.

The “this” and “super” Keywords.
The Current Object (“this” ).
The Direct Superclass (“super” ).

Practical Uses of the “this” and “super” Keywords.
Using “super” to Reference Members in Different Packages.

Multiple Current Instances (a.k.a. Levels).
A Note About Deeply Nested Types.
Qualifying the “this” Keyword.
Qualifying the “new” Keyword.
Qualifying the “super” Keyword.

4. Primitive Data Types and Object.

The Definition of Data Types.
Data Type as a Set of Values.
The Object-Oriented Definition of Type.

Numeric Data Types.
Integral Types.
Floating-Point Types.
Understanding the Floating-Point Types.

The “char” Data Type.
The “boolean” Data Type.
The “null” Type.
The “Number” Class.
The “java.math” Package.
The “BigInteger” Class.
The “BigDecimal” Class.

Currency Calculations.
Inexact Results and Comparison Operators.
Rounding the Result of a Floating-Point Operation.
Using Integral Types to Store Monetary Values.

Primitive Type Wrapper Classes.
Parsing Strings for Primitive Type Values.
Converting Primitive Numeric Types to Strings.
Bit Pattern Manipulation.
Accessing Primitive Type System Properties.
Unicode Utility Methods.

The “Object” Class.
Reference Equality Versus the Equivalence Relationship.
Understanding Hash Tables.
The Five Housekeeping Methods.

The Comparison Methods.
What is Default Ordering?
What is Natural Ordering?
Reverse Order (or Descending) Sorts.
Sorting By More Than One Field.
The “Comparable” Interface.
The “Comparator” Interface.

5. Strings and Other Common Data Types.

Would-Be Mutator Methods.
The Length of a “String” or “StringBuffer” .
The Capacity of a “StringBuffer” .
Ensuring the Capacity of a “StringBuffer” .

“String” Indices.
Right-Open Intervals in “String” and “StringBuffer” .

Checked Exceptions in String and “StringBuffer” .
The “String” Class.
Case Mappings.
Comparing Strings.
Accessing Individual Characters or Substrings.
“char” to “String” Conversions and Vice Versa.
Translating Locally Encoded Strings.
Miscellaneous Methods in the “String” Class.
Unusual Constructors in the “String” Class.

The “StringBuffer” Class.
The Overloaded insert and append Methods.
Other Methods in the “StringBuffer” Class.

Other String-Related Classes.
The “StringCharacterIterator” Class.
The “StringReader” and “StringWriter” Classes.

Lexical Analysis.
The “BreakIterator” Class.
The “StringTokenizer” Class.
The “StreamTokenizer” Class.

String Concatenation Operations.
A Note about the Overloaded Binary + Operator.
Implicit String Conversions.
The Intern Mechanism.
Shared Character Buffers.

Displaying Diagnostic Messages on the Console.
Standard I/O.
The “print” and “println” Methods.

The Locale” Class.
The Default Locale.
Supported Locales.

The “Date” Class.
Date Comparisons.

The “GregorianCalendar” Class.
Instantiating the “GregorianCalendar” Class.
The Inconsistent Field Rule.
The Maximum DAY_OF_MONTH Rule.

Date and Time Fields in the Calendar Class.
Standard Default Values for Date and Time Fields.
Normalizing Date and Time Fields.
Date and Time Field Manipulation Methods.

The “TimeZone” Class.
Understanding the Difference between i18n and l10n.
The Localization of Common Data Types.
Formatting Numbers.
Formatting Dates and Times.

6. Arrays and The Collections Framework.

Array, Component, and Element Types.
The Canonical Form of the “for” Loop.
Array Classes Are Dynamically Created.
The Members of an Array Type.
Array Type Variable Declarations.
Initializing Array Type Variables.
Array Access Expressions.

A Bridge over Troubled Waters (the “toArray” Methods).
Untyped References versus Parameterized Types.
What Is Run-Time Type?

Time Complexities (or Big-O Notation).
Constant Time Operations.
Amortized Constant Time.
Logarithmic Time.
Linear Time.
Quadratic Time.

The Equivalence Relationship and Elements.
Duplicate Elements.
Using Mutable Objects as Elements in a “Set” or Keys in a “Map” .

The Collections Framework.
Bulk Operations.
The Principle of Maximum Generality.
The “Collection” Interface.
The Map Interface.
Housekeeping Methods for Containers.

General-Purpose Implementations.
Choosing a General-Purpose Implementation.
Performance Tuning the General-Purpose Implementations.

Special-Purpose Implementations.
“WeakHashMap” .

Synchronized Views.
Unmodifiable Views.
Range Views (Sublists, Subsets, and Submaps).
Collection Views of a Map.
List View of an Array.

List Iterators.
Using Collection Views to Iterate over a Map.
A Poor Man's Collection.
Synchronized Iterators.
Fail-Fast Iterators.
Iterating Backwards Through a “TreeSet” or “TreeMap” .

Al-Khwarizmi Concerning the Hindu Art of Reckoning.
Utility Methods for “Arrays” and Other “Collections” .
Sorting Containers.
Cloning versus Copying a Container.
The Minimum and Maximum Elements.
Convenience Implementations.
An “equals” Method for Arrays.

Custom Implementations of the Core Collection Interfaces.
Abstract Implementations.
Optional Operations.
Restricted Containers.
Standard Constructors.

Multimaps and Multidimensional Arrays.
Multidimensional Arrays.

Legacy Containers.


詳細而易懂,《Java™ Rules》是一本全面的參考書,適合應用程式開發人員掌握Java™程式語言的細節。《Java™ Rules》詳細描述了Java程式語言的核心和Java™虛擬機(JVM™),使程式設計師能夠高效地掌握Java平台。

《Java™ Rules》基於《Java™語言規範》和《Java™虛擬機規範》的第二版,以親切的教程風格呈現了這些規範的子集。從平台基礎到API,這本百科全書式的指南揭示了語言的每一個方面,包括以前未記錄的功能。在整本書中,實用的教程都有官方的語言文件或受尊敬的領導者分享的見解支持。這本書獨特的格式和對話風格非常適合有經驗的程式設計師,他們希望快速掌握語言的能力。

作為教程和詳細參考資料,《Java™ Rules》的這一卷涵蓋了以下內容:
- 語法結構、轉義序列和位置表示系統
- 編譯單元的結構
- 五種類別和介面
- 包含和內部類別層次結構(與繼承層次結構相對)
- 靜態修飾符、this和super
- 原始資料類型和物件
- 字串和其他常見資料類型
- 陣列和集合框架

有了《Java™ Rules》,無論是新手還是有經驗的程式設計師都可以迅速掌握這門語言。

- 前言
- 關於本書
- Java的傳統
- 1. 語法結構
- 2. 編譯單元
- ...(省略部分內容)