当前: 首页 - 图书专区 - Java编程思想(英文版·第4版)
Java编程思想(英文版·第4版)


  在线购买
Bruce Eckel
7-111-21250-8
79.00
1482
2007年04月24日

计算机 > 软件与程序设计 > JAVA
Prentice Hall
2823
英语
16开
Thinking in Java (Fourth Edition)
教材
经典原版书库







2003年《Software Development》杂志最佳书籍Jolt大奖
  2003年《Java Developer’s Journal》读者选择最佳书籍奖
  2001年《JavaWorld》编辑选择最佳书籍奖
  2000年《JavaWorld》读者选择最佳书籍奖
  1999年《Software Development》杂志最佳产品奖
  1998年《Java Developer’s Journal》编辑选择最佳书籍奖
  本书赢得了全球程序员的广泛赞誉,即使是最晦涩的概念,在Bruce Eckel的文字亲和力和小而直接的编程示例面前也会化解于无形。从Java的基础语法到最高级特性(深入的面向对象概念、多线程、自动项目构建、单元测试和调试等),本书都能逐步指导你轻松掌握。

  第4版特色
  ●适合初学者与专业人员的经典的面向对象叙述方式,为更新的Java SE5/6增加了新的示例和章节。
  ●测验框架显示程序输出。
  ●设计模式贯穿于众多示例中:适配器、桥接器、职责链、命令、装饰器、外观、工厂方法、享元、点名、数据传输对象、空对象、代理、单例、状态、策略、模板方法以及访问者。
  ●为数据传输引入了XML,为用户界面引入了SWT和Flash。
  ●重新撰写了有关并发的章节,有助于读者掌握线程的相关知识。
  ●专门为第4版以及Java SE5/6重写了700多个编译文件中的500多个程序。
  ●支持网站包含了所有源代码、带注解的解决方案指南、网络日志以及多媒体学习资料。
  ●覆盖了所有基础知识,同时论述了高级特性。
  ●详细地阐述了面向对象原理。
  ●在线可获得Java讲座CD,其中包含Bruce Eckel的全部多媒体讲座。
  ●在www.MindView.net网站上可以观看现场讲座、咨询和评论。
Preface 1Introduction 13

Prerequisites 14

Learning Java 14

Goals 15

Teaching from this book 16

JDK HTML documentation 17

Exercises 17

Foundations for Java 18

Source code 18

Errors 21

Introduction to Objects 23
The progress of abstraction 24

An object has an interface 26

An object provides services 29

The hidden implementation 30

Reusing the implementation 32

Inheritance 33

Interchangeable objects with polymorphism 38

The singly rooted hierarchy 43

Containers 44

Object creation & lifetime 46

Exception handling: dealing with errors 49

Concurrent programming 50

Java and the Internet 51

Summary 60

Everything Is an Object 61
You manipulate objects with references 61

You must create all the objects 63

You never need to destroy an object 67

Creating new data types: class 69

Methods, arguments, and return values 72

Building a Java program 74

Your first Java program 78

Comments and embedded documentation 81

Coding style 88

Summary 89

Exercises 89

Operators 93
Simpler print statements 93

Using Java operators 94

Precedence 95

Assignment 95

Mathematical operators 98

Auto increment and decrement 101

Relational operators 103

Logical operators 105

Literals 108

Bitwise operators 111

Shift operators 112

Ternary if-else operator 116

String operator + and += 118

Common pitfalls when using operators 119

Casting operators 120

Java has no “sizeof” 122

A compendium of operators 123

Summary 133

Controlling Execution 135
true and false 135

if-else 135

Iteration 137

Foreach syntax 140

return 143

break and continue 144

The infamous “goto” 146

switch 151

Summary 154

Initialization & Cleanup 155
Guaranteed initialization with the constructor 155

Method overloading 158

Default constructors 166

The this keyword 167

Cleanup: finalization and garbage collection 173

Member initialization 181

Constructor initialization 185

Array initialization 193

Enumerated types 204

Summary 207

Access Control 209
package: the library unit 210

Java access specifiers 221

Interface and implementation 228

Class access 229

Summary 233

Reusing Classes 237
Composition syntax 237

Inheritance syntax 241

Delegation 246

Combining composition and inheritance 249

Choosing composition vs. inheritance 256

protected 258

Upcasting 260

The final keyword 262

Initialization and class loading 272

Summary 274

Polymorphism 277
Upcasting revisited 278

The twist 281

Constructors and polymorphism 293

Covariant return types 303

Designing with inheritance 304

Summary 310

Interfaces 311
Abstract classes and methods 311

Interfaces 316

Complete decoupling 320

“Multiple in heritance” in Java 326

Extending an interface with inheritance 329

Adapting to an interface 331

Fields in interfaces 335

Nesting interfaces 336

Interfaces and factories 339

Summary 343

Inner Classes 345
Creating inner classes 345

The link to the outer class 347

Using .this and .new 350

Inner classes and upcasting 352

Inner classes in methods and scopes 354

Anonymous inner classes 356

Nested classes 364

Why inner classes? 369

Inheriting from inner classes 382

Can inner classes be overridden? 383

Local inner classes 385

Inner-class identifiers 387

Summary 388

Holding Your Objects 389
Generics and type-safe containers 390

Basic concepts 394

Adding groups of elements 396

Printing containers 398

List 401

Iterator 406

LinkedList 410

Stack 412

Set 415

Map 419

Queue 423

Collection vs. Iterator 427

Foreach and iterators 431

Summary 437

Error Handling with Exceptions 443
Concepts 444

Basic exceptions 445

Catching an exception 447

Creating your own exceptions 449

The exception specification 457

Catching any exception 458

Standard Java exceptions 468

Performing cleanup with finally 471

Exception restrictions 479

Constructors 483

Exception matching 489

Alternative approaches 490

Exception guidelines 500

Summary 501

Strings 503
Immutable Strings 503

Overloading &8216;+’ vs. StringBuilder 504

Unintended recursion 509

Operations on Strings 511

Formatting output 514

Regular expressions 523

Scanning input 546

StringTokenizer 551

Summary 552

Type Information 553
The need for RTTI 553

The Class object 556

Checking before a cast 569

Registered factories 582

instanceof vs. Class equivalence 586

Reflection: runtime class information 588

Dynamic proxies 593

Null Objects 598

Interfaces and type information 607

Summary 613

Generics 617
Comparison with C++ 618

Simple generics 619

Generic interfaces 627

Generic methods 631

Anonymous inner classes 645

Building complex models 647

The mystery of erasure 650

Compensating for erasure 662

Bounds 673

Wildcards 677

Issues 694

Self-bounded types 701

Dynamic type safety 710

Exceptions 711

Mixins 713

Latent typing 721

Compensating for the lack of latent typing 726

Using function objects as strategies 737

Summary: Is casting really so bad? 743

Arrays 747
Why arrays are special 747

Arrays are first-class objects 749

Returning an array 753

Multidimensional arrays 754

Arrays and generics 759

Creating test data 762

Arrays utilities 775

Summary 786

Containers in Depth 791
Full container taxonomy 791

Filling containers 793

Collection functionality 809

Optional operations 813

List functionality 817

Sets and storage order 821

Queues 827

Understanding Maps 831

Hashing and hash codes 839

Choosing an implementation 858

Utilities 879

Holding references 889

Java 1.0/1.1 containers 893

Summary 900

I/O 901
The File class 901

Input and output 914

Adding attributes and useful interfaces 918

Readers & Writers 922

Off by itself: RandomAccessFile 926

Typical uses of I/O streams 927

File reading & writing utilities 936

Standard I/O 941

Process control 944

New I/O 946

Compression 973

Object serialization 980

XML 1003

Preferences 1006

Summary 1008

Enumerated Types 1011
Basic enum features 1011

Adding methods to an enum 1014

enums in switch statements 1016

The mystery of values() 1017

Implements, not inherits 1020

Random selection 1021

Using interfaces for organization 1022

Using EnumSet instead of flags 1028

Using EnumMap 1030

Constant-specific methods 1032

Multiple dispatching 1047

Summary 1057

Annotations 1059
Basic syntax 1060

Writing annotation processors 1064

Using apt to process annotations 1074

Using the Visitor pattern with apt 1079

Annotation-based unit testing 1083

Summary 1106

Concurrency 1109
The many faces of concurrency 1111

Basic threading 1116

Sharing resources 1150

Terminating tasks 1179

Cooperation between tasks 1197

Deadlock 1223

New Library components 1229

Simulation 1253

Performance tuning 1270

Active objects 1295

Summary 1300

Graphical User Interfaces 1303
Applets 1306

Swing basics 1307

Making a button 1311

Capturing an event 1312

Text areas 1315

Controlling layout 1317

The Swing event model 1321

A selection of Swing components 1332

JNLP and Java Web Start 1376

Concurrency & Swing 1382

Visual programming and JavaBeans 1393

Alternatives to Swing 1415

Building Flash Web clients with Flex 1416

Creating SWT applications 1430

Summary 1447

A: Supplements 1449
Downloadable supplements 1449

Thinking in C: Foundations for Java 1449

Thinking in Java seminar 1450

Hands-On Java seminar-on-CD 1450

Thinking in Objects seminar 1450

Thinking in Enterprise Java 1451

Thinking in Patterns (with Java) 1452

Thinking in Patterns seminar 1452

Design consulting and reviews 1453

B: Resources 1455
Software 1455

Editors & IDEs 1455

Books 1456

Index 1463

Bruce Eckel 是MindView公司(www.MindView.net)的总裁,该公司向客户提供软件咨询和培训。他是C++标准委员会拥有表决权的成员之一,拥有应用物理学学士和计算机工程硕士学位。除本书外,他还是《C++编程思想》(该书影印版及翻译版已由机械工业出版社引进出版)的作者,并与人合著了《C++编程思想 第2卷》及其他著作。他已经发表了150多篇论文,还经常参加世界各地的研讨会并进行演讲。
读者书评
发表评论



高级搜索
Spring技术内幕:深入解析Spring架构与设计原理(第2版)
Struts2技术内幕:深入解析Struts架构设计与实现原理
编写高质量代码:改善Java程序的151个建议


版权所有© 2008 北京华章图文信息有限公司 京ICP备08102525号 京公网安备110102004606号
通信地址:北京市百万庄南街1号 邮编:100037
电话:(010)68318309, 88378998 传真:(010)68311602, 68995260