Home > Store

Thinking in Java, 4th Edition

Register your product to gain access to bonus material or receive a coupon.

Thinking in Java, 4th Edition

Book

  • Your Price: $59.99
  • List Price: $74.99
  • Usually ships in 24 hours.

About

Features

Bruce Eckel's Classic, award-winning Thinking in Java, Fourth Edition--now fully updated and revised for J2SE 5.0!

° The awards for this book keep piling up! They include Software Development Magazine Jolt Award for best book, 2003; Java Devloper's Journal Reader's Choice Award for Best Book, 2003, 2001, 1998; JavaWorld Editor's Choice Award for Best Book 2001; Software Development Magazine Productivity Award, 1999

° 12 new chapters including chapters on Generics and Arrays

Description

  • Copyright 2006
  • Dimensions: 7" x 9-1/4"
  • Pages: 1520
  • Edition: 4th
  • Book
  • ISBN-10: 0-13-187248-6
  • ISBN-13: 978-0-13-187248-6

Thinking in Java should be read cover to cover by every Java programmer, then kept close at hand for frequent reference. The exercises are challenging, and the chapter on Collections is superb! Not only did this book help me to pass the Sun Certified Java Programmer exam; it’s also the first book I turn to whenever I have a Java question.”
—Jim Pleger, Loudoun County (Virginia) Government
Much better than any other Java book I’ve seen. Make that ‘by an order of magnitude’.... Very complete, with excellent right-to-the-point examples and intelligent, not dumbed-down, explanations.... In contrast to many other Java books I found it to be unusually mature, consistent, intellectually honest, well-written, and precise. IMHO, an ideal book for studying Java.”
—Anatoly Vorobey, Technion University, Haifa, Israel
“Absolutely one of the best programming tutorials I’ve seen for any language.”
—Joakim Ziegler, FIX sysop
“Thank you again for your awesome book. I was really floundering (being a non-C programmer), but your book has brought me up to speed as fast as I could read it. It’s really cool to be able to understand the underlying principles and concepts from the start, rather than having to try to build that conceptual model through trial and error. Hopefully I will be able to attend your seminar in the not-too-distant future.”
—Randall R. Hawley, automation technician, Eli Lilly & Co.
“This is one of the best books I’ve read about a programming language.... The best book ever written on Java.”
—Ravindra Pai, Oracle Corporation, SUNOS product line
“Bruce, your book is wonderful! Your explanations are clear and direct. Through your fantastic book I have gained a tremendous amount of Java knowledge. The exercises are also fantastic and do an excellent job reinforcing the ideas explained throughout the chapters. I look forward to reading more books written by you. Thank you for the tremendous service that you are providing by writing such great books. My code will be much better after reading Thinking in Java. I thank you and I’m sure any programmers who will have to maintain my code are also grateful to you.”
—Yvonne Watkins, Java artisan, Discover Technologies, Inc.
“Other books cover the what of Java (describing the syntax and the libraries) or the how of Java (practical programming examples). Thinking in Java is the only book I know that explains the why of Java: Why it was designed the way it was, why it works the way it does, why it sometimes doesn’t work, why it’s better than C++, why it’s not. Although it also does a good job of teaching the what and how of the language, Thinking in Java is definitely the thinking person’s choice in a Java book.”
—Robert S. Stephenson
Awards for Thinking in Java
2003 Software Development Magazine Jolt Award for Best Book
2003 Java Developer’s Journal Reader’s Choice Award for Best Book
2001 JavaWorld Editor’s Choice Award for Best Book
2000 JavaWorld Reader’s Choice Award for Best Book
1999 Software Development Magazine Productivity Award
1998 Java Developer’s Journal Editor’s Choice Award for Best Book

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, Thinking in Java

Sample Content

Downloadable Sample Chapter

Untitled Document Visit Bruce Eckel's web site to read sample chapters from Thinking in Java, Fourth Edition

Sample Pages

Download Chapter: Operators

Table of Contents

Preface 1

Introduction 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

Index

Download the Index file related to this title.

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020