Thinking in Java

Overview

Bruce Eckel's Thinking in Java&#8212

  • JavaWorld Editor's Choice Award for Best Book, 2001
  • JavaWorld Reader's Choice Award for Best Book, 2000
  • Software Development Magazine Productivity Award, 1999
  • Java Developer's Journal Editor's Choice Award for Best Book, 1998
  • Software Development Magazine Jolt ...
See more details below
Available through our Marketplace sellers.
Other sellers (Paperback)
  • All (45) from $1.99   
  • New (2) from $2.58   
  • Used (43) from $1.99   
Close
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any BN.com coupons and promotions
$2.58
Seller since 2013

Feedback rating:

(3)

Condition:

New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.

New
PAPERBACK New 0136597238 New Item. Purchase Protected By Our Satisfaction Guarantee.

Ships from: Fort Wayne, IN

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$29.99
Seller since 2013

Feedback rating:

(113)

Condition: New
Brand New Item.

Ships from: Chatham, NJ

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
Page 1 of 1
Showing All
Close
Sort by
Sending request ...

Overview

Bruce Eckel's Thinking in Java&#8212

  • JavaWorld Editor's Choice Award for Best Book, 2001
  • JavaWorld Reader's Choice Award for Best Book, 2000
  • Software Development Magazine Productivity Award, 1999
  • Java Developer's Journal Editor's Choice Award for Best Book, 1998
  • Software Development Magazine Jolt Product Excellence Award (for Thinking in C++), 1995

Thinking in Java has earned raves from programmers worldwide for its extraordinary clarity, careful organization, and small, direct programming examples. From the fundamentals of Java syntax to its most advanced features (in-depth object-oriented concepts, multithreading, automated project building, unit testing, and debugging), Thinking in Java is designed to teach, one simple step at a time.

  • The classic Java Introduction, fully updated for Java 2 version 1.4, with new topics throughout!
  • New testing framework validates each program and shows you the output.
  • New chapter on unit testing, automated building, assertions, logging, debugging, and other ways to keep your programs in tune.
  • Completely rewritten threading chapter gives you a solid grasp of the fundamentals.
  • 350+ working Java programs, rewritten for this edition. 15,000+ lines of code.
  • Companion web site includes all source code, annotated solution guide, essays and other resources.
  • Includes entire Foundations for Java multimedia seminar on CD-ROM for Windows, Linux and Mac.
  • For beginners and experts alike.
  • Teaches Java linguistics, not platform-dependent mechanics.
  • Thorough coverage of fundamentals; demonstrates advanced topics.
  • Explains sound object-oriented principles as they apply to Java.
  • Hands-on Java CD available online, with 15 hours of lectures and slides by Bruce Eckel.
  • Live seminars, consulting, and reviews available.


Destined to become a classic, this tutorial guides you through the fundamentals and the advanced aspects of Java. Author Bruce Eckel uses the same style, format, incisive prose and clear examples as he did in Thinking in C++. He doesn't just teach how to write code, he teaches how to think and program in Java. This highly recommended text is designed for those familiar with programming concepts and object-orientation. Eckel covers objects, program flow, error handling, network programming and design patterns. He includes details on the cornerstones of Java and OOP, with polymorphism, implementation hiding, class differentiation and reuse. He also covers passing/returning objects and running multiple concurrent subtasks.

Read More Show Less

Editorial Reviews

From Barnes & Noble
The Barnes & Noble Review
Wonderfully organized, full of high-quality examples, and polished to reflect today’s best practices, Bruce Eckel’s Thinking in Java, Third Edition may be the world's best way to learn Java.

Previous editions have earned worldwide praise and prizes -- notably the Java Developer's Journal Editor's Choice award, and Software Development's Productivity Award. This new Third Edition is the best yet. Yes, it fully reflects Sun’s recent Java 2 SDK 1.4 release. But if you’re accustomed to “run of the mill” programming books, you’ll be astounded at how much attention Eckel has given to improving the coverage of features that haven’t changed.

Among this book’s strengths have always been its structure and careful choice of topics. In this edition, Eckel thoroughly revisits both, to ensure that the book still give programmers a rock-solid grasp of today’s fundamentals. For instance, while most authors would’ve been thrilled with the multithreading coverage presented in earlier editions, Eckel has thoroughly rewritten this chapter (now renamed “Concurrency”) to offer far deeper insight for real-world development.

Even more important, Eckel has increasingly recognized the crucial role of unit testing for high-quality Java development. (Of course, he’s not the only one to realize this: Testing is at the heart of agile methodologies like Extreme Programming, which Eckel admires. Chances are you’ll be called upon to become much more actively involved in testing in coming days. This book will prepare you.)

With unit testing, Eckel points out, “the build process can check for more than just syntax errors, since you teach it how to check for semantic errors as well.” By integrating unit testing into the build process, you can “be bolder in the changes that you make, more easily refactor your code when you discover design or implementation flaws, and in general produce a better product, faster.”

To this end, Eckel has used unit testing throughout this edition to validate his code and display the expected output. (Much of that output now appears in the book, responding to one of the few criticisms made of earlier editions.)

As part of a detailed new chapter on “Discovering Problems,” he also walks through the construction of a simple unit testing framework -- and offers detailed coverage of using the latest version of JUnit to perform more sophisticated functionality testing. The same chapter also covers JDK 1.4’s new logging and assertions support, as well as debugging and profiling techniques every Java developer needs.

Since there’s more to cover in Java than ever before, Eckel’s had to battle to keep this book down to size. (People have actually complained that Thinking in Java is too big -- which is like complaining that someone’s given you too many diamonds.) So he’s moved J2EE coverage out of this book (they’re downloadable, and will become part of his forthcoming Thinking in Enterprise Java). That means more space for crucial topics like analysis and design; class reuse techniques; collections; and I/O -- including Java 1.4’s newio.

As always, Eckel approaches Java with short, “bite-size” examples, each explaining one concept with total clarity, and organized to build step-by-step, from simple to sophisticated. For this edition, Eckel has revisited virtually all of his code examples. Some old examples are gone; many new ones have been added. In many cases, he’s thoroughly redesigned and reimplemented his examples, to improve consistency and to reflect today’s best practices for Java programming. In rewriting his code, he has a huge advantage over most other authors: the extensive feedback he gets in his seminars, event appearances, and at his hugely popular web site.

The accompanying CD-ROM contains electronic versions of the book plus all of its source code. But it also contains the solution to one of the key obstacles that face many developers trying to learn Java for the first time. Java’s roots are in C. To really instinctively “get” Java, it helps to know at least the rudiments of C. So Eckel has bundled a complete interactive “Thinking in C” training course that covers everything you ought to know before you start learning Java. Just another example of how committed Eckel is to making sure you really get it. Bill Camarda

Bill Camarda is a consultant, writer, and web/multimedia content developer. His 15 books include Special Edition Using Word 2000 and Upgrading & Fixing Networks For Dummies®, Second Edition.

Read More Show Less

Product Details

  • ISBN-13: 9780136597230
  • Publisher: Prentice Hall Professional Technical Reference
  • Publication date: 2/19/1998
  • Edition description: Older Edition
  • Edition number: 1
  • Pages: 1098
  • Product dimensions: 7.02 (w) x 9.22 (h) x 1.60 (d)

Meet the Author

Bruce Eckel is the author of Thinking in C++, which won the Software Development Jolt Award for best book on 1995. He's been professionally programming for 20 years and has been teaching people throughout the world how to program with objects since 1986, first as a reknowned speaker and consultant on C++ and now in Java. He was a voting member of the C++ Standards Committee, has written 5 other books on object-oriented programming, published over 150 articles, and has been a columnist for various computer magazines, including the Java columnist for Web Techniques. He chairs the C++ and Java tracks for the Software Development Conference and holds a BS in Applied Physics and an MS in Computer Engineering.
Read More Show Less

Read an Excerpt

PREFACE:
Read More Show Less

Table of Contents

Preface 1
Introduction 9
1 Introduction to Objects 31
2 Everything is an Object 77
3 Controlling Program Flow 107
4 Initialization & Cleanup 165
5 Hiding the Implementation 215
6 Reusing Classes 241
7 Polymorphism 279
8 Interfaces & Inner Classes 315
9 Error Handling with Exceptions 371
10 Detecting Types 423
11 Collections of Objects 453
12 The Java I/O System 583
13 Concurrency 699
14 Creating Windows & Applets 765
15 Discovering Problems 909
16 Analysis and Design 997
A Passing & Returning Objects 1021
B Java Programming Guidelines 1071
C: Supplements 1085
D: Resources 1091
Index 1097
Read More Show Less

Preface

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 impact on our lives, but I'm not so sure it will dwarf the computer 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 truly 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 ableto eliminate bugs of all sorts that I know would have otherwise 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 it didn't stem the demand for the published book. Most people don't want to read the entire book on screen, and hauling around a 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 revolution 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 sufficient interest warrants it will the book be put on paper. Currently, the great majority of books of all kinds are financial failures, and perhaps this new approach could 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 the language is different than in all the other languages 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 solved. Because of this complexity, most of our programming projects fail. And yet of all the programming languages that I am aware, none of them have gone all out and decided that their main design 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 causes programmers to eventually "hit the wall" with that language. For example, C++ had to be backwards-compatible with C (to allow easy migration for C programmers), as well as efficient. Those are both very useful 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 all the extensions piled upon VB have produced some truly horrible and un-maintainable syntax. On the other hand, C++, VB 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 types of problems.

What has impressed me most as I have come to understand Java is what seems like an unflinching goal of reducing complexity for the programmer. As if to say "we don't care about anything except reducing the time and difficulty of producing robust code." In the early 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 important, 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, dynamic code changes, and even security, each of which can fit on your complexity spectrum anywhere from "impediment" to "show-stopper." 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 they're working on making it easier all the time). Network programming is how we talk to each other more effectively and cheaply than we ever have with telephones (email alone has revolutionized many businesses). As we talk to each other more, amazing things begin to happen, possibly 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 types of machines, and easily writing programs that communicate across the Internet - Java increases the communication bandwidth between people. And 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 planet. I've heard it suggested that the next revolution is the formation of a kind of global mind which 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 here by attempting to teach the language.

Read More Show Less

Introduction

Like any human language, Java provides a way to express concepts. If successful, this medium of expression will be significantly easier and more flexible than the alternatives as problems grow larger and more complex.
You can't look at Java as just a collection of features; some of the features make no sense in isolation. You can use the sum of the parts only if you are thinking about design, not simply coding. And to understand Java in this way, you must understand the problems with it and with programming in general. This book discusses programming problems, why they are problems, and the approach Java has taken to solve them. Thus, the set of features I explain in each chapter are based on the way I see a particular type of problem being solved with the language. In this way I hope to move you, a little at a time, to the point where the Java mindset becomes your native tongue.

Throughout, I'll be taking the attitude that you want to build a model in your head that allows you to develop a deep understanding of the language; if you encounter a puzzle you'll be able to feed it to your model and deduce the answer.

Prerequisites

This book assumes that you have some programming familiarity; you understand that a program is a collection of statements, the idea of a subroutine/function/macro, control statements such as "if" and looping constructs such as "while," etc. However, you might have learned this in many places, such as programming with a macro language or working with a tool like Perl. As long as you've programmed to the point where you feel comfortable with the basic ideas of programming, you'll be able to workthrough this book. Of course, the book will be easier for the C programmers and more so for the C++ programmers, but don't count yourself out if you're not experienced with those languages (but come willing to work hard). I'll be introducing the concepts of object-oriented programming and Java's basic control mechanisms, so you'll be exposed to those, and the first exercises will involve the basic control-flow statements.

Although references will often be made to C and C++ language features, these are not intended to be insider comments, but instead to help all programmers put Java in perspective with those languages, from which, after all, Java is descended. I will attempt to make these references simple and to explain anything that I think a non- C/C++ programmer would not be familiar with.

Learning Java

At about the same time that my first book Using C++ (Osborne/McGraw-Hill 1989) came out, I began teaching that language. Teaching programming languages has become my profession; I've seen nodding heads, blank faces, and puzzled expressions in audiences all over the world since 1989. As I began giving in-house training with smaller groups of people, I discovered something during the exercises. Even those people who were smiling and nodding were confused about many issues. I found out, by chairing the C++ track at the Software Development Conference for the past few years (and now also the Java track), that I and other speakers tended to give the typical audience too many topics too fast. So eventually, through both variety in the audience level and the way that I presented the material, I would end up losing some portion of the audience. Maybe it's asking too much, but because I am one of those people resistant to traditional lecturing (and for most people, I believe, such resistance results from boredom), I wanted to try to keep everyone up to speed.

For a time, I was creating a number of different presentations in fairly short order. Thus, I ended up learning by experiment and iteration (a technique that also works well in Java program design). Eventually I developed a course using everything I had learned from my teaching experience - one that I would be happy giving for a long time. It tackles the learning problem in discrete, easy-to-digest steps and in a hands-on seminar (the ideal learning situation), there are exercises following each of the short lessons. I now give this course in public Java seminars, which you can find out about at http://www.BruceEckel.com. (The introductory seminar is also available as a CD ROM. Information is available at the same Web site.)

The feedback that I get from each seminar helps me change and refocus the material until I think it works well as a teaching medium. But this book isn't just a seminar handout - I tried to pack as much information as I could within these pages and structured it to draw you through onto the next subject. More than anything, the book is designed to serve the solitary reader who is struggling with a new programming language.

Goals

Like my previous book Thinking in C++, this book has come to be structured around the process of teaching the language. In particular, my motivation is to create something that provides me with a way to teach the language in my own seminars. When I think of a chapter in the book, I think in terms of what makes a good lesson during a seminar. My goal is to get bite-sized pieces that can be taught in a reasonable amount of time, followed by exercises that are feasible to accomplish in a classroom situation.

My goals in this book are to:

  1. Present the material one simple step at a time so that you can easily digest each concept before moving on.
  2. Use examples that are as simple and short as possible. This sometimes prevents me from tackling "real world" problems, but I've found that beginners are usually happier when they can understand every detail of an example rather than being impressed by the scope of the problem it solves. Also, there's a severe limit to the amount of code that can be absorbed in a classroom situation. For this I will no doubt receive criticism for using "toy examples," but I'm willing to accept that in favor of producing something pedagogically useful.
  3. Carefully sequence the presentation of features so that you aren't seeing something that you haven't been exposed to. Of course, this isn't always possible; in those situations, a brief introductory description is given.
  4. Give you what I think is important for you to understand about the language, rather than everything I know. I believe there is an information importance hierarchy, and that there are some facts that 95 percent of programmers will never need to know and just confuses people and adds to their perception of the complexity of the language. To take an example from C, if you memorize the operator precedence table (I never did), you can write clever code. But if you need to think about it, it will also confuse the reader/maintainer of that code. So forget about precedence, and use parentheses when things aren't clear.
  5. Keep each section focused enough so that the lecture time - and the time between exercise periods - is small. Not only does this keep the audience's minds more active and involved during a hands-on seminar, but it gives the reader a greater sense of accomplishment.
  6. Provide you with a solid foundation so that you can understand the issues well enough to move on to more difficult coursework and books.

Online documentation

The Java language and libraries from Sun Microsystems (a free download) come with documentation in electronic form, readable using a Web browser, and virtually every third party implementation of Java has this or an equivalent documentation system. Almost all the books published on Java have duplicated this documentation. So you either already have it or you can download it, and unless necessary, this book will not repeat that documentation because it's usually much faster if you find the class descriptions with your Web browser than if you look them up in a book. (Plus it will be up-to-date.) This book will provide extra descriptions of the classes only when it's necessary to supplement the documentation so you can understand a particular example.

Chapters

This book was designed with one thing in mind: the way people learn the Java language. Seminar audience feedback helped me understand which parts were difficult and needed illumination. In the areas where I got ambitious and included too many features all at once, I came to know - through the process of presenting the material - that if you include a lot of new features, you need to explain them all, and this easily compounds the student's confusion. As a result, I've taken a great deal of trouble to introduce the features as few at a time as possible.

The goal, then, is for each chapter to teach a single feature, or a small group of associated features, in such a way that no additional features are relied upon. That way you can digest each piece in the context of your current knowledge before moving on.

Here is a brief description of the chapters contained in the book, which correspond to lectures and exercise periods in my hands-on seminars.

Chapter 1: Introduction to objects
This chapter is an overview of what object-oriented programming is all about, including the answer to the basic question "What's an object?", interface vs. implementation, abstraction and encapsulation, messages and functions, inheritance and composition, and the all-important polymorphism. You'll also be introduced to issues of object creation such as constructors, where the objects live, where to put them once they're created, and the magical garbage collector that cleans up the objects that are no longer needed. Other issues will be introduced, including error handling with exceptions, multithreading for responsive user interfaces, and networking and the Internet. You'll also learn about what makes Java special, why it's been so successful, and about object-oriented analysis and design.
Chapter 2: Everything is an object
This chapter moves you to the point where you can write your first Java program, so it must give an overview of the essentials, including the concept of a "handle" to an object; how to create an object; an introduction to primitive types and arrays; scoping and the way objects are destroyed by the garbage collector; how everything in Java is a new data type (class) and how to create your own classes; functions, arguments, and return values; name visibility and using components from other libraries; the static keyword; comments and embedded documentation.
Chapter 3: Controlling program flow
This chapter begins with all of the operators that come to Java from C and C++. In addition, you'll discover common operator pitfalls, casting, promotion, and precedence. This is followed by the basic control-flow and selection operations that you get with virtually any programming language: choice with if-else; looping with for and while; quitting a loop with break and continue as well as Java's labeled break and labeled continue (which account for the "missing goto" in Java); and selection using switch. Although much of this material has common threads with C and C++ code, there are some differences. In addition, all the examples will be full Java examples so you'll get more comfortable with what Java looks like.
Chapter 4: Initialization and cleanup
This chapter begins by introducing the constructor, which guarantees proper initialization. The definition of the constructor leads into the concept of function overloading (since you might want several constructors). This is followed by a discussion of the process of cleanup, which is not always as simple as it seems. Normally, you just drop an object when you're done with it and the garbage collector eventually comes along and releases the memory. This portion explores the garbage collector and some of its idiosyncrasies. The chapter concludes with a closer look at how things are initialized: automatic member initialization, specifying member initialization, the order of initialization, static initialization and array initialization.
Chapter 5: Hiding the implementation
This chapter covers the way that code is packaged together, and why some parts of a library are exposed while other parts are hidden. It begins by looking at the package and import keywords, which perform file-level packaging and allow you to build libraries of classes. The subject of directory paths and file names is also examined. The remainder of the chapter looks at the public, private, and protected keywords, the concept of "friendly" access, and what the different levels of access control mean when used in various contexts.
Chapter 6: Reusing classes
The concept of inheritance is standard in virtually all OOP languages. It's a way to take an existing class and add to its functionality (as well as change it, the subject of Chapter 7). Inheritance is often a way to reuse code by leaving the "base class" the same, and just patching things here and there to produce what you want. However, inheritance isn't the only way to make new classes from existing ones. You can also embed an object inside your new class with composition. In this chapter you'll learn about these two ways to reuse code in Java, and how to apply them.
Chapter 7: Polymorphism
On your own, you might take nine months to discover and understand polymorphism, a cornerstone of OOP. Through small, simple examples you'll see how to create a family of types with inheritance and manipulate objects in that family through their common base class. Java's polymorphism allows you to treat all objects in this family generically, which means the bulk of your code doesn't rely on specific type information. This makes your programs extensible, so building programs and code maintenance is easier and cheaper. In addition, Java provides a third way to set up a reuse relationship through the interface, which is a pure abstraction of the interface of an object. Once you've seen polymorphism, the interface can be clearly understood. This chapter also introduces Java 1.1 inner classes.
Chapter 8: Holding your objects
It's a fairly simple program that has only a fixed quantity of objects with known lifetimes. In general, your programs will always be creating new objects at a variety of times that will be known only while the program is running. In addition, you won't know until run-time the quantity or even the exact type of the objects you need. To solve the general programming problem, you need to create any number of objects, anytime, anywhere. This chapter explores in depth the tools that Java supplies to hold objects while you're working with them: the simple arrays and more sophisticated collections (data structures) such as Vector and Hashtable. Finally, the new and improved Java 1.2 collections library is explored in depth.
Chapter 9: Error handling with exceptions
The basic philosophy of Java is that badly-formed code will not be run. As much as possible, the compiler catches problems, but sometimes the problems - either programmer error or a natural error condition that occurs as part of the normal execution of the program - can be detected and dealt with only at run-time. Java has exception handling to deal with any problems that arise while the program is running. This chapter examines how the keywords try, catch, throw, throws, and finally work in Java; when you should throw exceptions and what to do when you catch them. In addition, you'll see Java's standard exceptions, how to create your own, what happens with exceptions in constructors, and how exception handlers are located.
Chapter 10: The Java IO system
Theoretically, you can divide any program into three parts: input, process, and output. This implies that IO (input/output) is a pretty important part of the equation. In this chapter you'll learn about the different classes that Java provides for reading and writing files, blocks of memory, and the console. The distinction between "old" IO and "new" Java 1.1 IO will be shown. In addition, this section examines the process of taking an object, "streaming" it (so that it can be placed on disk or sent across a network) and reconstructing it, which is handled for you in Java version 1.1. Also, Java 1.1's compression libraries, which are used in the Java ARchive file format (JAR), are examined.
Chapter 11: Run-time type identification
Java run-time type identification (RTTI) lets you find the exact type of an object when you have a handle to only the base type. Normally, you'll want to intentionally ignore the exact type of an object and let Java's dynamic binding mechanism (polymorphism) implement the correct behavior for that type. But occasionally it is very helpful to know the exact type of an object for which you have only a base handle. Often this information allows you to perform a special-case operation more efficiently. This chapter explains what RTTI is for, how to use it and how to get rid of it when it doesn't belong there. In addition, the Java 1.1 reflection feature is introduced.
Chapter 12: Passing and returning objects
Since the only way you talk to objects in Java is through "handles," the concepts of passing an object into a function and returning an object from a function have some interesting consequences. This chapter explains what you need to know to manage objects when you're moving in and out of functions, and also shows the String class, which uses a different approach to the problem.
Chapter 13: Creating windows and applets
Java comes with the Abstract Window Toolkit (AWT), which is a set of classes that handle windowing in a portable fashion; these windowing programs can either be applets or stand-alone applications. This chapter is an introduction to the AWT and the creation of World Wide Web applets. We'll also look at pros and cons of the AWT and the GUI improvements introduced in Java 1.1. The important "Java Beans" technology is introduced. This is fundamental for the creation of Rapid-Application Development (RAD) program-building tools. Finally, the new Java 1.2 "Swing" library is introduced - this provides a dramatic improvement in UI components for Java.
Chapter 14: Multiple threads
Java provides a built-in facility to support multiple concurrent subtasks, called threads, running within a single program. (Unless you have multiple processors on your machine, this is only the appearance of multiple subtasks.) Although these can be used anywhere, threads are most powerful when trying to create a responsive user interface so, for example, a user isn't prevented from pressing a button or entering data while some processing is going on. This chapter looks at the syntax and semantics of multithreading in Java.
Chapter 15: Network programming
All the Java features and libraries seem to really come together when you start writing programs to work across networks. This chapter explores communication across the Internet, and the classes that Java provides to make this easier. It also shows you how to create a Java applet that talks to a common gateway interface (CGI) program, shows you how to write CGI programs in C++ and covers Java 1.1's Java DataBase Connectivity (JDBC) and Remote Method Invocation (RMI).
Chapter 16: Design patterns
This chapter introduces the very important and yet non-traditional "patterns" approach to program design. An example of the design evolution process is studied, starting with an initial solution and moving through the logic and process of evolving the solution to more appropriate designs. You'll see one way that a design can materialize over time.
Chapter 17: Projects
This chapter includes a set of projects that build on the material presented in this book, or otherwise didn't fit in earlier chapters. These projects are significantly more complex than the examples in the rest of the book, and they often demonstrate new techniques and uses of class libraries.
There are subjects that didn't seem to fit within the core of the book, and yet I find that I discuss them during seminars. These are placed in the appendices.
Appendix A: Using non-Java code
A totally portable Java program has serious drawbacks: speed and the inability to access platform-specific services. When you know the platform that you're running on, it's possible to dramatically speed up certain operations by making them native methods, which are functions that are written in another programming language (currently, only C/C++ is supported). There are other ways that Java supports non-Java code, including CORBA. This appendix gives you enough of an introduction to these features that you should be able to create simple examples that interface with non-Java code.
Appendix B:Comparing C++ and Java
If you're a C++ programmer, you already have the basic idea of object-oriented programming, and the syntax of Java no doubt looks very familiar to you. This makes sense because Java was derived from C++. However, there are a surprising number of differences between C++ and Java. These differences are intended to be significant improvements, and if you understand the differences you'll see why Java is such a beneficial programming language. This appendix takes you through the important features that make Java distinct from C++.
Appendix C:Java programming guidelines
This appendix contains suggestions to help guide you while performing low-level program design and writing code.
Appendix D:Performance
This will allow you to find bottlenecks and improve speed in your Java program.
Appendix E:A bit about garbage collection
This appendix describes the operation and approaches that are used to implement garbage collection.
Appendix F:Recommended reading
A list of some of the Java books I've found particularly useful.

Exercises

I've discovered that simple exercises are exceptionally useful during a seminar to complete a student's understanding, so you'll find a set at the end of each chapter.

Most exercises are designed to be easy enough that they can be finished in a reasonable amount of time in a classroom situation while the instructor observes, making sure that all the students are absorbing the material. Some exercises are more advanced to prevent boredom for experienced students. The majority are designed to be solved in a short time and test and polish your knowledge. Some are more challenging, but none present major challenges. (Presumably, you'll find those on your own - or more likely they'll find you).

Multimedia CD-ROM

To accompany this book a Multimedia CD ROM is available separately, but this is not like the CDs that you'll usually find packaged with books. Those often only contain the source code for the book. (The code for this book is freely downloadable from the Web site www.BruceEckel.com.) This CD ROM is a separate product and contains the entire contents of the week-long "Hands-On Java" training seminar. This is more than 15 hours of lectures given by Bruce Eckel, synchronized with 500 slides of information. The seminar is based on this book so it is an ideal accompaniment.

The CD ROM contains two versions of this book:

  1. A printable version identical to the one available for download.
  2. For easy on-screen viewing and reference, a screen-formatted and hyperlinked version which is available exclusively on the CD-ROM. These hyperlinks include:
    • 230 chapter, section, and sub-heading links
    • 3600 index links
The CD ROM contains over 600MB of content. We believe that it sets a new standard for value.

The CD ROM contains everything in the printable version of the book and everything (with the important exception of personalized attention!) from the five-day full-immersion training seminars. We believe that it sets a new standard for quality.

The CD ROM is available only by ordering directly from the Web site www.BruceEckel.com.

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 5 Customer Reviews
  • Anonymous

    Posted June 21, 2003

    Excellent Book

    Overall Rating: Well done! This book will be a valuable teaching and reference tool. Teaching Value: Excellent! An essential book on this topic. Reference Value: A complete reference. I would not need any additional reference on this topic. This book is tremendous. The explanations are so clear and direct. Being a Java professional I read so many java books, but this book is incomparable. It¿s the best-advanced thinking Java book I¿ve ever read. The best part of this is book the step-by step explanation. Each chapter takes one new topic and explains it with simple steps and examples, which is easy way to understand anything and that is really appreciable in this book. Each example program is explained with its output. The chapter on threading is magnificent, its gives the fundamental to deep knowledge of each concept, and with such easy step that one can grasp it thoroughly. All the object-oriented principles are explained so well as they apply to java along with working examples.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted March 23, 2003

    An update of Eckel's classic text

    It is with some pleasure that I review Bruce Eckel's third edition of his already-classic 'Thinking in Java'. Four years ago, I read his first edition. It had a rare elegance amongst the literal ton of Java books already on the market. Enough others must have agreed, for a second edition came out soon thereafter. And now we have this third edition, that describes the latest Java, version 1.4. If you are new to Java and are casting around for a suitable book, try this. The code examples and explanatory text are very clear. Little is assumed for prerequisites. Even if you have never programmed inany language, this will still be useful. Object oriented programming is explained in general terms that will be familiar to any C++ programmers. Plus, if you already know some Java, but are uncertain about various nooks and crannies, this book may also help flesh out your understanding. It is not a Dummies [trade mark??] book. The most complicated chapter seems to be about multithreading/concurrency. Always a difficult topic for many readers. Eckel carefully steps through the issues here in a lucid way. By the way, Eckel makes the text available on his website. But he and his publisher, Pearson, have made the calculation that most readers will still prefer a traditional bound copy, than peering at a computer screen or shuffling through looseleaf hardcopy. Which I suppose is a little ironic, given the subject material and the audience.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted March 11, 2000

    Great book to learn from!

    I've been programming for 1 1/2 years now in Java, and this book is what gave me my start. Before that, I bought all the Java books I could get my hands on, but I couldnt grasp the logic of OOP until reading Bruce's book. Plain english, easy-to-read and great examples. In fact, I still occassionally refer to the book to try new things in Java (like Serialization, etc). Great book if you're a beginner or a confused intermediate!!

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted December 27, 1999

    Good for beginners

    Excellent for beginners as the book covers all fundamental aspects usually ignored by a lot of other books. The book is available free on the web but its a good idea to buy the hard copy and support the team.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted February 5, 2011

    No text was provided for this review.

Sort by: Showing all of 5 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)