Java 编程思想(英文版.第2版)
作者 : Bruce Eckel
丛书名 : 经典原版书库
出版日期 : 2002-01-01
ISBN : 7-111-09286-4
定价 : 69.00元
教辅资源下载
扩展信息
语种 : 英文
页数 : 1164
开本 : 16开
原书名 : Thinking In Java
原出版社: Prentice Hall
属性分类: 教材
包含CD :
绝版 : 已绝版
图书简介

From the fundamentals of Java syntax to its most advanced features (distributed computing, advanced Object-oriented capabilities, multithreading), Thinking In Java is designed to teach. Bruce Eckel's readable style and small, direct programming examples malce even the most arcane concepts clear.

图书前言

I suggested to my brother Todd, Who is making the leap from hardware into programming, that the next big revolution will be in genetic engineering.
  We'll have microbes designed to make food, fuel, and plastic; they'll clean up pollution and in general allow us to master the manipulation of the physical world for a fraction of what it costs now. I claimed that it would make the computer revolution look small in comparison.Then I realized I was making a mistake common to science fiction writers:getting lost in the technology (which is of course easy to do in science fiction). An experienced writer knows that the story is never about the things; it's about the people. Genetics will have a very large inlpact on our lives, but I'm not so sure it will dwarf the eomputer revolution (which enables the genetic revolution)--or at least the information revolution.Information is about talking to each other: yes, cars and shoes and especially genetic cures are important, but in the end those are just trappings. What tru1y matters is how we relate to the world. And so much of that is about communication.
  This book is a case in point. A majority of fOlks thought I was very bold or a little crazy to put the entire thing up on the Web. "Why would anyone buy it " they asked. If I had been of a more conservative nature I wouldn't have done it, but I really didn't want to write another computer book in the same old way. I didn't know what would happen but it turned out to be the smartest thing I've ever done with a book.
  For one thing, people started sending in corrections. This has been an amazing process, because folks have looked into every nook and cranny and caught both technical and grammatical errors, and I've been able to eliminate bugs of all sorts that I know would have othedrise slipped through. People have been simply terrific about this, very often saying "Now, I don't mean this in a critical way..." and then giving me a collection of errors I'm sure I never would have found. I feel like this has been a kind of group process and it has really made the book into something special.
  But then I started hearing "OK, fine, it's nice you've put up an electronic version, but I want a printed and bound copy from a real publisher." I tried very hard to make it easy fOr everyone to print it out in a nice looking format but that didn't stem the demand for the published book. Most people don't want to read the entire book on screen, and hauling around 8 sheaf of papers, no matter how nicely printed, didn't appeal to them either. (Plus, I think it's not so cheap in terms of laser printer toner.) It seems that the computer revoiution won't put publishers out of business,after all. However, one student suggested this may become a model for future publishing: books will be published on the Web first, and only if suffcient interest warrants it will the book be put on paper. Currently, the great majority of all books are financial failures, and perhaps this new approach couId make the publishing industry more profitable.
  This book became an enlightening experience for me in another way. I originally approached Java as "just another programming language," which in many senses it is. But as time passed and I studied it more deeply, I began to see that the fundamental intention of this language is different from all the other lariguages I have seen.
  Programming is about managing complexity: the complexity of the problem you want to solve, laid upon the complexity of the machine in which it is so1ved. Because of this complexity, most of our programming projects fail. And yet, of all the programming languages of which I am aware, none of them have gone all-out and decided that their main desigr goal would be to conquer the complexity of developing and maintaining programs. Of course, many language design decisions were made with complexity in mind, but at some point there were always some other issues that were considered essential to be added into the mix. Inevitably,those other issues are what cause programmers to eventual1y "hit the wall" with that language. For example, C++ had to be backwardscompatible with C (to allow easy migration for C programmers), as well a efficient. Those are both very usefu1 goals and account for much of the success of C++, but they also expose eXtra complexity that prevents some projects from being finished (certainly, you can blame programmers and management, but if a language can help by catching your mistakes, why shouldn't it ). As another example, Visual Basic (VB) was tied to BASIC, which wasn't really designed to be an extensible language, so al1 the extensions piled upon VB have produced some truly horrible and unmaintainable syntax. Perl is backwards-compatible with Awk, Sed,Grep, and other Unix tools it was meant to replace, and as a resu1t is often accused of producing "write-only code" (that is, after a few months you can't read it). On the other hand, C++, VB, Perl, and other languages like Smalltalk had some of their design efforts focused on the issue of complexity and as a result are remarkably successful in solving certain mpes of problems.
  What has impressed me most as I have come to understand Java is what seems like an unflinching goal of reducing complexityfor the programmer. As if to say "we don't care about anything except reducing the time and difficulty of producing robust code." In the ear1y days, this goal has resulted in code that doesn't run very fast (although there have been many promises made about how quickly Java will someday run) but it has indeed produced amazing reductions in development time; half or less of the time that it takes to create an equivalent C++ program. This result alone can save incredible amounts of time and money, but Java doesn't stop there. It goes on to wrap all the complex tasks that have become impoFtant, such as multithreading and network programming, in language features or libraries that can at times make those tasks trivial.And finally, it tackles some really big complexity problems: cross-platform programs, dy'namic code changes, and even security, each of which can fit on your complexity spectrum anywhere from "impediment" to "showstopper." So despite the performance problems we've seen, the promise of Java is tremendous: it can make us significantly more productive programmers.
  One of the places I see the greatest impact for this is on the Web. Network programming has always been hard, and Java makes it easy (and the Java language designers are working on making it even easier). Network programming is how we talk to each other more effectively and cheaper than we ever have with telephones (email alone has revolutionized many businesses). As we talk to each other more, amazing things begin to happen, possib1y more amazing even than the promise of genetic engineering.
  In all ways--creating the programs, working in teams to create the programs, building user interfaces so the programs can communicate with the user, running the programs on different wnes of machines, and easily writing programs that communicate across the Internet-Java increases the communication bandwidth between people. I think that perhaps the results of the communication revolution will not be seen from the effects of moving large quantities of bits around; we shall see the true revolution because we will all be able to talk to each other more easily:one--on-one, but also in groups and, as a p1anet. I've heard it suggested that the next revolution is the fornlation of a kind of global mind that results from enough people and enough interconnectedness. Java may or may not be the tool that foments that revolution, but at least the possibility has made me feel like I'm doing something meaningful by attempting to teach the language.
  
Preface to the 2nd edition
  People have made many, many wonderful comments about the firstedition of this book, which has naturally been very pleasant for me. However, every now and then someone wtll have complaints, and for some rcason one complail1t that comes up periodically is "the book is too big." In my mind it is faint damnation indeed if "too many pages" is your only complaint. (One is reminded of the Emperor of Anstria's complaint about Mozart's work: "Too many notes!" Not that I am ill any way trying to compare myself to Mozart.) In addition, I ean only assume that such a complaint comes from someone who is yet to be acquainted with the vastness of the Java language itself, and has not seen the rest of the books on the subject--for example, my favorite reference is Cay Horstmann & Gary Cornell's Core Java (Prentice-Hall), which grew so big it had to be broken into two volumes. Despite this, one of the things I have attempted to do in this edition is trim out the portions that have become obsolete, on at least nonessential. I feel comfOrtable doing this because the original material remains on the Web site and the CD ROM that accompanies this book, in the form of the freely-downloadable first edition of the book ( at www.BruceEckel.com). If you want the old stuff it's still there, and this is a wonderful relief for an author. For example, you may notice that the original last chapter, "Projects," is no longer here; two of the projects have been integrated into other chapters, and the rest were no longer appropriate. Also, the "Design Pattens" chapter became too big and has been moved into a book of its own (also downloadabIe at the web site). So, by all rights the book should be thinner.
  But alas, it is not to be.
  The biggest issue is the continuing development of the Java language itself, and in particular the expanding APIs that promise to provide standard interfaces for just about everything you'd like to do (and I won't be surprised to see the "JToaster" API eventua11y appear). Covering all these APIs is obviously beyond the scope of this book and is a task relegated to other authors, but some issues cannot be ignored. The biggest of these include server--side Java (primarily Servlets & Java Server pages,or JSPs), which is truly an excellent solution to the World Wide Web problem, whereill we've discovered that the various Web browser platforms are just not consistent enough to support client-side programming. In addition, there is the whole problem of easily creating applications to interact with databases, transactions, security, and the like, which is invo1ved wtth Enterprise Java Beans (EJBs). These topics are wrapped into the chapter formerly called "Network Programming" and now called "Distributed Computing," a subject that is becoming essential to everyone. You'll also find this chapter has been expanded to include an ovetwew of Jini (pronounced "genie," and it isn't an acronym,just a name), which is a cutting-edge technology that al1ows us to change the way we think about interconnected applications. And of course the book has been changed to use the Swing GUI library throughout. Again, if you want the old Java 1.0/1.1 stuffyou can get it from the freelydownloadable book at www.BruceEckel.com (it is also included on this edition's new CD ROM, bound into the book; more on that a little later).
  Aside from additional small language features added in Java 2 and corrections made throughout the book, the other major change is in the collections chapter (9), which now focuses on the Java 2 collections used throughout the book. I've a1so improved that chapter to more deeply go into some of the important issues of collections, in particular how a hash function works (so that you can know how to properly create one). There have been other movements and changes, ineluding a rewrite of Chapter1, and removal of some appendices and other materia1 that I consider no 1onger necessary fOr the printed book, but those are the bulk of them. In general, I've tried to go over everythiflg, remove from the 2nd edition what is no longer necessary (but whieh still exists in the electronic first edition),include changes, and improve everything I could. As the language continues to ehange--albeit not quite at the same breakneek pace as before--there will no doubt be further editions of this book.
  For those of you who still can't stand the size of the book, I do apologize.Believe it or not, I have worked hard to keep it small. Despite the bu1k, I feel like there may be enough alternatives to satisfy you. For one thing,the book is available electronical1y (from the Web site, and also on the CD ROM that accompanies this book), so if you carry your laptop you can carry the book on that with no extra weight. If yoll're really into slimming down, there are actuaI1y Palm Pilot versions of the book floating around.(One person told me he would read the book in bed on his Palm wtth the backlighting on to keep from annoying his wife. I can only hope that it helps send him to slumberland.) If you need it on paper, I know of people who print a chapter at a time and carry it in their briefCase to read on the tra in.
  Java 2
  At this writing, the release of Sun's Java Development Kit (JDK) 1.3 is imminent, and the proposed changes for JDK l.4 have been pub1icized.Although these version numbers are still in the "ones," the standard way to refer to any version of the language that is JDK 1.2 or greater is to call it "Java 2." This indicates the very significant changes between "old Java"-which had many warts that I complained about in the first edition of this book--and this more modern and improved version of the language,which has far fewer warts and many additions and nice designs.
  This book is written for Java 2. 1 have the great luxury of getting rid of all the old stuff and writing to only the new, improved language because the old information still exists in the electronic 1st edition on the Web and on the CD ROM (which is where you can go if you're stuck using a pre--Java-2 version of the language). also, because anyone can freely download the JDK from java.sun.eom, it means that by writing to Java 2 I'm not imposing a financial hardship on someone by forcing them to upgrade.
  There is a bit of a catch, however. JDK 1.3 has some improvements that I'd really like to use, but the version of Java that is current1y being released for Linux is JDK 1.2.2. Linux (see www.Linux.org) is a very important development in conjunction with Java, because it is fast becoming the most important server platform out there--fast, reliable,robust, secure, well-maintained, and free, a true revolution in the history of computing (I don't think we've ever seen all of those features in any tool before). And Java has found a very important niche in server-side programming in the fOrm of Servlets, a technology that is a huge improvement over the traditional CGI programming (this is covered in the "Distributed Programming" chapter).
  So although I would like to only use the very newest features, it's critical that everything compiles under Linux, and so when you unpack the source code and compile it under that OS (with the latest JDK) you'll discover that eveothing will compile. However, you wtll find that I've put notes about features in JDK 1.3 here and there.


作者简介

Bruce Eckel:Bruce Eckel:  Bruce Eckel 是MindView公司 (www.MindView.net) 的总裁,向客户提供软件咨询和培训。他是C++标准委员会拥有表决权的成员之一。他也是《Java编程思想》(该书第3版影印版及翻译版已由机械工业出版社引进出版)、《C++编程思想 第1卷》及其他C++著作的作者,已经发表了150多篇论文 (其中有许多C++语言方面的论文) ,他经常参加世界各地的研讨会并进行演讲。

图书目录

Preface
Preface to the 2nd edition
The CD ROM
Introduction
Prerequisites
LearningJava
Goals
Online documentation
Chapters
Exercises
Multirnedia CD ROM
Source code
Java versions
Seminars and mentoring
Errors
Note on the cover design
Acknowledgements
Introduction
Objects
The progress of abstraction
An object has an interface
The hidden implementation
Reusing the implementation
Inheritance: reusing the interface
Interchangeable objects with polymorphism
Object landscapes and lifetimes
Exception handling:dealing with errors
Multithreading
Persistence
Java and the lnternet
Analysis and design
Extreme programming
Why Java succeeds
Strategies for transition
Java vs. C++
Summary
2: Everything is an Object
You manipolate objects with references
You must create all the objeas
You never need to destroy an object
Creating new data types: class
Methods, arguments,and return values
Building a Java program
Your first Java program
Comments and embedded docomentation
Coding style
Summary
Exercises
3 : Controlling
Program Flow
Using Java operators
Execution control
Sommary
Exercises
i4: Initialization & Cleanup
Guaranteed initialization with the constructor
Method overloading
Cleanup : finalization and garbage collection
Member initialization
Array initialization
Summary
Exercises
5:Hidingthe
Implem package:the libraty unit
Java access specifiers
Interface and implementation
Class access
Summary
Exercises
6: Reusing-Classes
Composition syntax
Inheritance syntax
Combining composition and inheritance
Choosing composition vs. inheritance protected
Incremental development
Upcasting
The final keyword lnitialization and class loading
Summary
Exercises
7:Polymorphism
Upcasting revisited
The twist
Overriding vs.overloading
Abstract classes and methods
Constructors and polymorphism
Designing with inheritance
Summary
Exercises
8:Interfaces&
InnerClassex
Interfaces
Inner classes
Summary
Exercises
9: Holding
YourObjects
Arrays
Introduction to containers
Container disadvantage:unknown type
Iterators
Container taxonomy
Collection functionality
List functionality
Set functionality
Map functionality
Holding references
Iterators revisited
Choosing an implementation
Sorting and searching Lists
Utilities
Unsupported operations
Java 1.0/1.1containers
Summary
Exercises
10:Error Handing with Exceptions
Basic exceptions
Catching an exception
Creating your own exceptions
The exception specification
Standard Java exceptions
Performing cleanup with finally
Exception restrictions
Constructors
Exception matching
Summary
Exercises
11:The Java
I/O System the File class
Input and output
Adding attributes and useful interfaces
Readers&Writers
Off by itself:
RandomAccessFile
Typical uses of I/O streams
Standard I/O
Compression
Object serialization
Tokenizing input
Summary
Exercises
12:Run-time Type
Identification
The need for RTTI
RTTI syntax
Reflection:run-time class information
Summary
Exercises
13:Creation windows
&Appets
The basic applet
Running applets from the command line
Making a button
Capturing an event
Text areas
Controlling layout
The Swing event model
A catalig of Swing components
Packaging an applet into a JAR file
Programming techniques
Visual programming and Beans
Summary
Exercises
14:Multiple Threads
Responsive userinterfaces
Sharing limited resources
Blocking
Priorities
Runnable revisited
Summary
Exercises
15:Distributed
Computing
Network programming
Java Database
Connectivity(JDBC)
Servlets
Java Server Pages
RMI(RemoteMethod Invocation)
CORBA
Enterprise JavaBeans
Jini:distributed services
Summary
Exercises
A:Passing&Returning Objects
Passing references around
Making local copies
Controlling cloneability
Read-only classes
Summary
Exercises
B:The JavaNative
Interface(JNI)
Calling a native method
Accessing JNI functions:
the JNIEnvargument.1069
Passing and using Java objects
JNI and Javaexceptions
JNIand threading
Using a preexisting code base
Additional information
C:Java Programming
Guidelines design
Implementation
D: Resources
Software
Books
Index

教学资源推荐
作者: 陈琼 主编 马千里 周育人 副主编 胡劲松 罗荣华 参编
作者: 林伟伟 刘波 编著
作者: (美)塞巴斯蒂安·拉施卡(Sebastian Raschka),瓦希德·米尔贾利利(Vahid Mirjalili)著
作者: 赵淑芬 主编  康宇光 副主编
参考读物推荐
作者: 丛霖 郑志强 编著
作者: 章小莉 王艳红 等
作者: 杨楠楠 李凯东 陈新涛 萧饭饭 等著