请输入您要查询的百科知识:

 

词条 Java核心技术卷Ⅰ:基础知识
释义

图书信息

传世经典书丛Java核心技术:卷Ⅰ:基础知识:第8版(评注版)

(美)科内尔(Cornell,G.)著

公飞评注

ISBN 978-7-121-13362-6

2011年6月出版

定 价:99.00元

16开

648页

内 容 简 介

《Java核心技术》(Core Java)自第1版出版以来,一直备受广大Java程序设计人员的青睐,畅销不衰,是Java经典书籍。第8版针对Java SE 6平台进行了全面更新,囊括了Java平台标准版(Java SE/J2SE)的全部基础知识,提供了大量完整且具有实际意义的应用实例,详细介绍了Java语言基础知识、面向对象程序设计、接口与内部类、事件监听器模型、swing图形用户界面程序设计、打包应用程序、异常处理、登录与调试、泛型程序设计、集合框架、多线程等内容。

本评注版力邀国内资深专家执笔,在英文原著基础上增加了点评和注释,并对原书内容进行了精简,删除了Java图形窗口编程的相关内容,即原书的第7~10章,同时对章节序号进行了相应的调整,从而使本书更集中于Java核心语言。

本评注版的目的旨在以先行者的学研心得与实践感悟,对读者的阅读和学习加以点拨、指明捷径。

书中示例程序经过精心设计,不但具有实用价值,而且易于阅读理解,可以作为初学者自己编写程序的良好开端,也能够帮助程序员快速地了解Java SE 6的新特性,或迅速从其他语言转向Java语言。

评注者序

大约在八九年前,我刚好是《Java核心技术》第5版的读者,弹指之间,Java已经历很多变化,《Java核心技术》也已经升级到了第8版,并且一度成为畅销图书。我还曾不止一次向Java新人推荐此书,却不曾想现在竟有幸成为本书评注版的评注者。重读本书倍感亲切,不由地感叹一本好书对于学习的正面影响不可限量。

这里借本书再写一下个人对Java学习要点的理解,也算是对本书内容的一个导读(本评注版的内容对原书进行了精简,删除了原书的第7~10章,并对原书的章节序号进行了相应的调整。也即是说,本评注版中的第7~10章是原书的11~14章)。

第1章是对Java的概要介绍,其中并不涉及Java的具体语法,但是包含了一些Java创新的思想和方法。当你成为资深设计人员或者成为软件开发的技术领导者之后,这些创新的思想和方法也许能给你一些启示。

第2章介绍Java编程环境,包括使用JDK进行基于命令行的开发,以及集成开发环境Eclipse。这是Java编程的基础,特别是通过掌握基于命令行的开发可以帮助你深刻理解Java的编写、编译、运行机制,这个机制的掌握对于学习Java非常重要。

第3章是Java的基础编程结构。基础当然重要,这里不用再多说了。

第4、5章分别介绍了Java的对象和类,以及Java的继承。这两章是Java面向对象编程的核心,也是学习Java的关键之一。要想成为Java高手,务必深刻理解这两章的内容。

第6章介绍Java的接口和内部类。内部类并不太重要,但是在编程语言中引入接口绝对是Java最具革命性的创新。这是Java编程构件化架构体系的重要基础。读者对Java的接口一定要好好理解。

第7章介绍Java的异常、日志、断言和调试等。一个正规的程序一定有着良好的异常处理机制和完善的日志系统。

第8章介绍Java的范型。范型是Java后来加入的内容,有些复杂,需要你耐心一点,慢慢理解。

第9章介绍Java的集合。本章主要是理解Java的集合类集成与实现体系,以及各种集合类的实现机理与特点,从而能够恰当地选择并使用合适的集合类。

第10章介绍Java的多线程。多线程是软件开发的高级话题,也是现代程序设计中非常重要的内容,尤其是对于网络服务端程序的开发具有重要的意义。多线程编程通常比较复杂,需要仔细理解,正确理解多线程运行的原理、概念,以及Java中多线程的实现方式是学习本章的关键。

虽称为评注者,然而本人才疏学浅,不可与脂砚斋、金圣叹等同日而语。仅希望能通过评注这种形式与Java初学者形成一种交流,通过对Java学习要点的一些提示和解释,以及对原书内容的一些补充,让Java初学者能够深入理解Java,并快速掌握Java。但愿本书能够对你学习Java带来帮助。

另外要说明一下,由于本书篇幅较大,为了节省成本和便于读者对照原书阅读,本评注版也标出了原书对应的页码,本书的索引所列页码(包括正文的页码引用)为原英文版页码。

公飞

2011年3月

目 录

Preface XVIII

Acknowledgements XXIV

Chapter 1 An Introduction to Java(新增批注共25条) 1

Java As a Programming Platform 2

The Java “White Paper” Buzzwords 3

Simple 3

Object Oriented 4

Network-Savvy 5

Robust 5

Secure 6

Architecture Neutral 7

Portable 8

Interpreted 9

High Performance 9

Multithreaded 10

Dynamic 10

Java Applets and the Internet 11

A Short History of Java 12

Common Misconceptions about Java 15

Chapter 2 The Java Programming Environment

(新增批注共20条) 21

Installing the Java Development Kit 22

Downloading the JDK 22

Setting the Execution Path 26

Installing the Library Source and Documentation 28

Installing the Core Java Program Examples 28

Navigating the Java Directories 29

Choosing a Development Environment 32

Using the Command-Line Tools 33

Troubleshooting Hints 43

Using an Integrated Development Environment 45

Locating Compilation Errors 49

Running a Graphical Application 55

Building and Running Applets 58

Chapter 3 Fundamental Programming Structures in Java

(新增批注共44条) 63

A Simple Java Program 64

Comments 68

Data Types 70

Integer Types 70

Floating-Point Types 71

The char Type 72

The boolean Type 74

Variables 74

Initializing Variables 76

Constants 76

Operators 77

Increment and Decrement Operators 78

Relational and boolean Operators 79

Bitwise Operators 81

Mathematical Functions and Constants 81

Conversions between Numeric Types 83

Casts 84

Parentheses and Operator Hierarchy 84

Enumerated Types 85

Strings 86

Substrings 86

Concatenation 86

Strings Are Immutable 87

Testing Strings for Equality 88

Code Points and Code Units 89

The String API 90

Reading the On-Line API Documentation 92

Building Strings 95

Input and Output 96

Reading Input 96

Formatting Output 98

File Input and Output 103

Control Flow 105

Block Scope 105

Conditional Statements 106

Loops 109

Determinate Loops 113

Multiple Selections—The switch Statement 117

Statements That Break Control Flow 119

Big Numbers 122

Arrays 124

The “for each” Loop 125

Array Initializers and Anonymous Arrays 126

Array Copying 126

Command-Line Parameters 128

Array Sorting 129

Multidimensional Arrays 132

Ragged Arrays 135

Chapter 4 Objects and Classes(新增批注共55条) 139

Introduction to Object-Oriented Programming 140

Classes 142

Objects 143

Identifying Classes 143

Relationships between Classes 144

Using Predefined Classes 146

Objects and Object Variables 146

The GregorianCalendar Class of the Java Library 150

Mutator and Accessor Methods 152

Defining Your Own Classes 158

An Employee Class 158

Use of Multiple Source Files 162

Dissecting the Employee Class 163

First Steps with Constructors 164

Implicit and Explicit Parameters 166

Benefits of Encapsulation 167

Class-Based Access Privileges 170

Private Methods 171

Final Instance Fields 171

Static Fields and Methods 172

Static Fields 172

Static Constants 173

Static Methods 174

Factory Methods 175

The main Method 175

Method Parameters 178

Object Construction 185

Overloading 185

Default Field Initialization 185

Default Constructors 186

Explicit Field Initialization 187

Parameter Names 188

Calling Another Constructor 188

Initialization Blocks 189

Object Destruction and the finalize Method 193

Packages 194

Class Importation 195

Static Imports 196

Addition of a Class into a Package 197

Package Scope 200

The Class Path 201

Setting the Class Path 203

Documentation Comments 204

Comment Insertion 204

Class Comments 205

Method Comments 205

Field Comments 206

General Comments 206

Package and Overview Comments 207

Comment Extraction 207

Class Design Hints 208

Chapter 5 Inheritance(新增批注共42条) 213

Classes, Superclasses, and Subclasses 214

Inheritance Hierarchies 222

Polymorphism 222

Dynamic Binding 224

Preventing Inheritance: Final Classes and Methods 226

Casting 227

Abstract Classes 229

Protected Access 234

Object: The Cosmic Superclass 235

The equals Method 236

Equality Testing and Inheritance 238

The hashCode Method 240

The toString Method 243

Generic Array Lists 248

Accessing Array List Elements 250

Compatibility between Typed and Raw Array Lists 254

Object Wrappers and Autoboxing 256

Methods with a Variable Number of Parameters 259

Enumeration Classes 260

Reflection 263

The Class Class 263

A Primer on Catching Exceptions 266

Using Reflection to Analyze the Capabilities of Classes 268

Using Reflection to Analyze Objects at Runtime 273

Using Reflection to Write Generic Array Code 277

Method Pointers! 281

Design Hints for Inheritance 284

Chapter 6 Interfaces and Inner Classes(新增批注共24条) 289

Interfaces 290

Properties of Interfaces 296

Interfaces and Abstract Classes 297

Object Cloning 298

Interfaces and Callbacks 305

Inner Classes 307

Use of an Inner Class to Access Object State 309

Special Syntax Rules for Inner Classes 312

Are Inner Classes Useful? Actually Necessary? Secure? 313

Local Inner Classes 316

Accessing final Variables from Outer Methods 316

Anonymous Inner Classes 319

Static Inner Classes 322

Proxies 325

Properties of Proxy Classes 333

Chapter 7 Exceptions, Logging, Assertions, and Debugging

(新增批注共38条) 335

Dealing with Errors 336

The Classification of Exceptions 338

Declaring Checked Exceptions 340

How to Throw an Exception 342

Creating Exception Classes 343

Catching Exceptions 344

Catching Multiple Exceptions 346

Rethrowing and Chaining Exceptions 348

The finally Clause 349

Analyzing Stack Trace Elements 352

Tips for Using Exceptions 357

Using Assertions 361

Assertion Enabling and Disabling 361

Using Assertions for Parameter Checking 362

Using Assertions for Documenting Assumptions 363

Logging 364

Basic Logging 364

Advanced Logging 365

Changing the Log Manager Configuration 367

Localization 368

Handlers 369

Filters 373

Formatters 373

A Logging Recipe 373

Debugging Tips 381

Using a Console Window 387

Tracing AWT Events 389

Letting the AWT Robot Do the Work 393

Using a Debugger 396

Chapter 8 Generic Programming(新增批注共22条) 401

Why Generic Programming? 402

Who Wants to Be a Generic Programmer? 403

Definition of a Simple Generic Class 404

Generic Methods 406

Bounds for Type Variables 407

Generic Code and the Virtual Machine 409

Translating Generic Expressions 411

Translating Generic Methods 411

Calling Legacy Code 413

Restrictions and Limitations 414

Type Parameters Cannot Be Instantiated with Primitive Types 414

Runtime Type Inquiry Only Works with Raw Types 415

You Cannot Throw or Catch Instances of a Generic Class 415

Arrays of Parameterized Types Are Not Legal 416

You Cannot Instantiate Type Variables 416

Type Variables Are Not Valid in Static Contexts of Generic Classes 418

Beware of Clashes After Erasure 418

Inheritance Rules for Generic Types 419

Wildcard Types 421

Supertype Bounds for Wildcards 423

Unbounded Wildcards 424

Wildcard Capture 425

Reflection and Generics 430

Using Class<T> Parameters for Type Matching 431

Generic Type Information in the Virtual Machine 431

Chapter 9 Collections(新增批注共55条) 437

Collection Interfaces 438

Separating Collection Interfaces and Implementation 439

Collection and Iterator Interfaces in the Java Library 441

Concrete Collections 447

Linked Lists 448

Array Lists 459

Hash Sets 459

Tree Sets 463

Object Comparison 464

Queues and Deques 469

Priority Queues 471

Maps 472

Specialized Set and Map Classes 476

The Collections Framework 481

Views and Wrappers 487

Bulk Operations 493

Converting between Collections and Arrays 494

Algorithms 494

Sorting and Shuffling 496

Binary Search 498

Simple Algorithms 499

Writing Your Own Algorithms 500

Legacy Collections 502

The Hashtable Class 502

Enumerations 502

Property Maps 503

Stacks 504

Bit Sets 504

Chapter 10 Multithreading(新增批注共24条) 509

What Are Threads? 511

Using Threads to Give Other Tasks a Chance 517

Interrupting Threads 524

Thread States 528

New Threads 529

Runnable Threads 529

Blocked and Waiting Threads 530

Terminated Threads 530

Thread Properties 531

Thread Priorities 531

Daemon Threads 533

Handlers for Uncaught Exceptions 534

Synchronization 535

An Example of a Race Condition 536

The Race Condition Explained 540

Lock Objects 541

Condition Objects 544

The synchronized Keyword 549

Synchronized Blocks 553

The Monitor Concept 554

Volatile Fields 555

Deadlocks 556

Lock Testing and Timeouts 559

Read/Write Locks 560

Why the stop and suspend Methods Are Deprecated 561

Blocking Queues 563

Thread-Safe Collections 570

Efficient Maps, Sets, and Queues 570

Copy on Write Arrays 572

Older Thread-Safe Collections 572

Callables and Futures 573

Executors 577

Thread Pools 578

Scheduled Execution 582

Controlling Groups of Tasks 583

Synchronizers 584

Semaphores 585

Countdown Latches 585

Barriers 585

Exchangers 586

Synchronous Queues 586

Example: Pausing and Resuming an Animation 586

Threads and Swing 592

Running Time-Consuming Tasks 594

Using the Swing Worker 598

The Single-Thread Rule 604

Index 607

随便看

 

百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2024/12/23 22:44:14