[PDF] [PDF] Thinking in Java Revision 10a - CIn UFPE

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 – 



Previous PDF Next PDF





[PDF] Thinking in Java Revision 10a - CIn UFPE

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 – 



[PDF] Thinking in Java 2nd edition, Revision 3 - UPV

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 



[PDF] Thinking in Java, 4th Editionpdf

5 oct 2005 · The entire effort is woven in a fabric that includes Eckel's own philosophy of object and program design A must for every C++ developer's 



[PDF] Esthetics of Lakon Ketoprak in Java Philosophy - Atlantis Press

Abstract—This study aims to describe the content of aesthetic values of Ketoprak in Javanese philosophy The material object is the Ketoprak Senapati Pinilih by 



[PDF] Java For Artists: The Art, Philosophy, and Science of Object-Oriented

Java For Artists: The Art, Philosophy, and Science of Object-Oriented Programming byRick MillerandRaffi Kasparian Pulp Free Press 2006 (854 pages) ISBN: 



[PDF] The Java Memory Model Jeremy Manson, Doctor of Philosophy

Jeremy Manson, Doctor of Philosophy, 2004 Dissertation directed by: for any programming language: in addressing them for Java, this dissertation provides a  

[PDF] java polymorphism example pdf

[PDF] java polymorphism example source code

[PDF] java practice exercises online

[PDF] java printf format

[PDF] java printf left justify string

[PDF] java production support interview questions

[PDF] java program list

[PDF] java program to get data from excel sheet

[PDF] java program to sort string array

[PDF] java program using conditional operator

[PDF] java programing book in hindi pdf

[PDF] java programming by sagayaraj pdf

[PDF] java programming exercises online

[PDF] java programming for beginners pdf free download

[PDF] java programming model answer paper summer 2017

About "Thinking in C++":Best Book! Winner of the Software Development Magazine Jolt Award! "This book is a tremendous achievement. You owe it to yourself to have a copy on your shelf. The chapter on iostreams is the most comprehensive and understandable treatment of that subject I've seen to date."

Al Stevens

Contributing Editor, Doctor Dobbs Journal

"Eckel's book is the only one to so clearly explain how to rethink program construction for object orientation. That the book is also an excellent tutorial on the ins and outs of C++ is an added bonus."

Andrew Binstock

Editor, Unix Review

"Bruce continues to amaze me with his insight into C++, and Thinking in C++ is his best collection of ideas yet. If you want clear answers to difficult questions about C++, buy this outstanding book."

Gary Entsminger

Author, The Tao of Objects

"Thinking in C++ patiently and methodically explores the issues of when and how to use inlines, references, operator overloading, inheritance and dynamic objects, as well as advanced topics such as the proper use of templates, exceptions and multiple inheritance. The entire effort is woven in a fabric that includes Eckel's own philosophy of object and program design. A must for every C++ developer's bookshelf, Thinking in C++ is the one C++ book you must have if you're doing serious development with C++."

Richard Hale Shaw

Contributing Editor, PC Magazine

Thinkingin

JavaBruce EckelPresident, MindView Inc.

©1997 All Rights ReservedRevision 10a, November 14, 1997 This file may be mirrored along with the site by obtaining permission from the author. The electronic version of the book is available free; you can get an updated copy along with source code at http://www.EckelObjects.com. Corrections are greatly appreciated;

please send them to Bruce@EckelObjects.comContact the author if you would like to include an electronic version of this book on

your product CD The electronic version of the book will continue to be free. You have permission to print a copy of the book for your own use. If you like the book, please:

1. Recommend it to your friends

2. Create links to the above site from your web page

3. Report any errors or problems you find

4. When the book is printed consider buying a copy (see the web site) - it's

probably cheaper than the toner cartridge you'll use up. However, if it

works well enough for you as an electronic document, great!5. Consider coming to one of my public Hand-On Java SeminarsCheck http://www.EckelObjects.com for in-depth details

and the date and location of the next

Hands-On Java Seminar

Based on this book

Taught personally by Bruce Eckel

Includes in-class programming exercises

· Also: Intermediate/Advanced seminars

Bruce Eckel's Hands-On Java Seminar

Multimedia CD

It22s like coming to the seminar!

Available at http://www.EckelObjects.com

(Available December 1997)Contains: · Overhead slides and Audio for all the lectures: just play it to see and hear the lectures! · Entire set of lectures is keyword indexed so you can rapidly locate the discussion of the subject you're interested in · Electronic version of "Thinking in Java" book on CD with automatic Internet update system

· Source code from the book

Dedication

To the person who, even now,

is creating the next great computer language

OverviewOverview9

What's Inside...11Preface171: Introduction to objects292: Everything is an object593: Controlling program flow79

4: Initialization & cleanup1195: Hiding the implementation1516: Reusing classes1697: Polymorphism1938: Holding your objects2459: Error handling with exceptions275

10: The Java IO system30111: Run-time type identification35912: Passing and returning objects379

13: Creating windows & applets413

14: Multiple threads515

15: Network programming571

16: Design patterns631

17: Projects669A: Using non-Java code699

B: Comparing C++ and Java701

C: Java programming guidelines709

D: A bit about garbage collection713

E: Recommended reading717

Index720

@What's Inside...

Overview9

What22s Inside..11

Learning Java..........18

Goals.................18

Chapters..............19

Exercises.............23

Source code............23

Coding standards.............24

Java versions............25

Seminars & Mentoring....25

Errors.................26

Acknowledgements.......26

1: Introduction to objects29The progress of abstraction.30

An object has an interface..31

The hidden implementation.32

Reusing the implementation33

Inheritance: reusing the interface

......................34

Overriding base-class functionality

.............................35

Is-a vs. is-like-a relationships..35

Interchangeable objects with

polymorphism............36

Dynamic binding..............37

The abstract base class......37

Object landscapes and lifetimes

..........................38 Collections and iterators......39The singly-rooted hierarchy....40

Collection libraries and support for easy

collection use..................41

The housekeeping dilemma: who should

clean up?........................42

Exception handling: dealing with errors

.............................43

Multithreading............44

Persistence...................45

Java and the Internet.......45

What is the Web?..............45

Client-side programming.....47

Server-side programming......51

A separate arena: applications.51

Online documentation......51

Analysis & Design..........52

Staying on course.............52

Phase 0: Let's make a plan...53

Phase 1: What are we making?53

Phase 2: How will we build it?54

Phase 3: Let's build it!..........55

Phase 4: Iteration..............55

Plans pay off....................56

Java vs. C++?.............56

2: Everything is an object59You manipulate objects through handles

..................................60

You must create all the objects60

Where storage lives...........61

Special case: primitive types.....62

Arrays in Java...................63

You never have to destroy an object

.............................63

Scoping...............................64

Scope of objects.............64

Creating new data types: class65Fields and methods........65Methods, arguments and return values ................67The argument list........67

Building a Java program...68

Name visibility............68

Using other components....69

The static keyword.........69

Your first Java program....71

Comments & embedded documentation

.......................73

Comment documentation...73

Syntax......................74

Embedded HTML..............74

@see: referring to other classes75

Class documentation tags.......75

Variable documentation tags...76

Method documentation tags...76

Documentation example.....77

Coding style..............77

Summary..............78

Exercises...............78

3: Controlling program flow79

Using Java operators......79Precedence...................80

Assignment.................80

Mathematical operators........82

Auto increment and decrement84

Relational operators...........85

Logical operators...............86

Bitwise operators..............88

Shift operators..................89

Ternary if-else operator......92

The comma operator.........93

String operator +.............93

Common pitfalls when using operators

.............................93

Casting operators..............94

Java has no "sizeof"...........96

Precedence revisited..........96

A compendium of operators.....97Execution control........105

True and false.................105

If-else.....................105

Iteration...........................106

Do-while......................107

Break and continue..........108

Switch.......................113

Summary..................116

Exercises...................117

4: Initialization & cleanup119Guaranteed initialization with the

constructor................119

Method overloading.........121

Distinguishing overloaded methods

..................................123

Overloading with primitives..123

Overloading on return values127

Default constructors..............127

The this keyword...........128Cleanup: finalization & garbage collection...................130

What is finalize( ) for?..........131

You must perform cleanup.....132Member initialization........135Specifying initialization.....136 Constructor initialization..137Array initialization.......142 Mulitdimensional arrays...146Summary..................148

Exercises....................149

5: Hiding the implementation151

Package: the library unit..152Creating unique package names154

A custom tool library.........156

Package caveat.................158

Java access specifiers....159

"Friendly"........................159 public: interface access.....159 private: you can't touch that!161 protected: "sort of friendly".162

Interface & implementation163

Class access...............164

Summary..................166

Exercises....................167

6: Reusing classes169Composition syntax.....169

Inheritance syntax.......172

Initializing the base class...174Combining composition & inheritance ............................176

Guaranteeing proper cleanup.177

Name hiding....................180

Choosing composition vs. inheritance

...............................181 protected.............182

Incremental development...182

Upcasting............183

Why "upcasting"?........184

The final keyword.......185

Final data..................185

Final methods.............188

Final classes................188

Final caution................189

Initialization & class loading190

Initialization with inheritance190

Summary..............191

Exercises...............192

7: Polymorphism193Upcasting.............193

Why upcast?..........194

The twist..........196

Method call binding.......196

Producing the right behavior.197

Extensibility.............199

Overriding vs. overloading.202

Abstract classes & methods203

Interfaces...........206

"Multiple inheritance" in Java209

Extending an interface with inheritance

.......................211

Grouping constants.......212

Initializing fields in interfaces212

Inner classes............213

Inner classes and upcasting...214

Inner classes in methods & scopes216

The link to the outer class.....220

Inheriting from inner classes.224

Can inner classes be overridden?225

Inner class identifiers.....226

Why inner classes: control frameworks

........................227

Constructors & polymorphism232

Order of constructor calls...233

Inheritance and finalize( )....234

Behavior of polymorphic methods inside

constructors.............237

Designing with inheritance239

Pure inheritance vs. extension240

Downcasting & run-time type identification

............................242

Summary...............243

Exercises..............244

8: Holding your objects245Arrays................245

Arrays are first-class objects.246

Returning an array..........249

Collections...............250

Disadvantage: unknown type251

Enumerators (iterators)...255

Types of collections....258

Vector....................258

BitSet.....................259

Stack..............................260

Hashtable.....................261

Enumerators revisited...........267

Sorting.....................268

The generic collection library272

Summary.................272

Exercises..................273

9: Error handling with

exceptions275Basic exceptions.......276 Exception arguments......277Catching an exception...277

The try block..................278

Exception handlers.........278

The exception specification..279

Catching any exception....280

Rethrowing an exception...281

Standard java exceptions...284

The special case of RuntimeException

..................................284

Creating your own exceptions285

Exception restrictions....288

Performing cleanup with finally

.........................291

What's finally for?........292

Pitfall: the lost exception....294

Constructors...............295

Exception matching.....298

Exception guidelines........299Summary..................300

Exercises...................300

10: The Java IO system301Input and output.......302

Types of InputStream.......302

Types of OutputStream......303

Adding attributes & useful interfaces

...............................304

Reading from an InputStream with

FilterInputStream...............305

Writing to an OutputStream with

FilterOutputStream........306

Off by itself: RandomAccessFile

..........................307

The File class............308

A directory lister............308

Checking for and creating directories

..................................312Typical uses of IO streams.314

Input streams.................316

Output streams..............318

Shorthand for file manipulation319

Reading from standard input.320

Piped streams.............321

StreamTokenizer....321

StringTokenizer.........324

Java 1.1 IO streams.....326

Sources & sinks of data.....327

Modifying stream behavior..327

Unchanged classes........328

An example................329

Redirecting standard IO....332

Compression...........333

Simple compression with GZIP334

Multi-file storage with zip....335

The Java archive (jar) utility..337

Object serialization......338

Finding the class............342

Controlling serialization.....343

Using persistence...........350

Summary.............356

Exercises..........357

11: Run-time

type identification359The need for RTTI.....359

The Class object........362

Checking before a cast.....364

RTTI syntax.........369

Reflection: run-time class information

.....................371

A class method extractor.....372

Summary...........376

Exercises............376

12: Passing and

returning objects379Passing handles around...380

Aliasing.....................380

Making local copies....382

Pass by value..............382

Cloning objects..............383

Adding cloneability to a class.384

Successful cloning...........385

The effect of Object.clone( )..387

Cloning a composed object...388

A deep copy with Vector..390

Deep copy via serialization....392

Adding cloneability further down a hierarchy

..........................394

Why this strange design?..394

Controlling cloneability....395

The copy-constructor........399

Read-only classes.......402

Creating read-only classes.....403

The drawback to immutability404

Immutable Strings.........406

The String and StringBuffer classes

...........................408

Strings are special..........411

Summary..................411

Exercises...................412

13: Creating windows

& applets413Why use the AWT?......414

The basic applet.........415

Testing applets................417

A more graphical example..418

Demonstrating the framework methods

............................418

Making a button........419

Capturing an event.....420

Text fields..................422

Text areas..................423

Labels...................424

Check boxes..............426Radio buttons............427

Drop-down lists.........428

List boxes..................429

handleEvent( )...............430

Controlling layout......432

FlowLayout...................432

BorderLayout................433

GridLayout.....................433

CardLayout....................434

GridBagLayout.............435

Alternatives to action().....436

Applet restrictions.........440

Applet advantages...........441

Windowed applications......442

Menus..............................442

Dialog boxes.....................445

The new AWT............450

The new event model.........451

Event and listener types.....452

Making windows and applets with the Java

1.1 AWT..........................457

Revisiting the earlier examples459

Binding events dynamically...475

Separating business logic from ui logic

...................................476

Recommended coding approaches478

New Java 1.1 UI APIs.........492

Desktop colors.................492

quotesdbs_dbs17.pdfusesText_23