Small Java How to Program and CD Version One Package / Edition 1

Small Java How to Program and CD Version One Package / Edition 1

by Harvey M. Deitel, Paul J. Deitel
     
 

ISBN-10: 0131541579

ISBN-13: 9780131541573

Pub. Date: 08/09/2004

Publisher: Pearson

Product Details

ISBN-13:
9780131541573
Publisher:
Pearson
Publication date:
08/09/2004
Pages:
624
Product dimensions:
6.98(w) x 9.12(h) x 0.72(d)

Table of Contents

Prefacexv
Before You Beginxxxvii
1Introduction to Computers, the Internet and the World Wide Web1
1.1Introduction2
1.2What Is a Computer?4
1.3Computer Organization4
1.4Early Operating Systems5
1.5Personal, Distributed and Client/Server Computing6
1.6The Internet and the World Wide Web6
1.7Machine Languages, Assembly Languages and High-Level Languages7
1.8History of C and C++8
1.9History of Java9
1.10Java Class Libraries9
1.11Fortran, Cobol, Pascal and Ada11
1.12Basic, Visual Basic, Visual C++, C# and .Net11
1.13Typical Java Development Environment12
1.14Notes about Java and Small Java How to Program, Sixth Edition15
1.15Test-Driving a Java Application16
1.16Introduction to Object Technology and the UML21
1.17Wrap-Up26
1.18Web Resources26
2Introduction to Java Applications35
2.1Introduction36
2.2First Program in Java: Printing a Line of Text36
2.3Modifying Our First Java Program43
2.4Displaying Text with printf45
2.5Another Java Application: Adding Integers47
2.6Memory Concepts51
2.7Arithmetic52
2.8Decision Making: Equality and Relational Operators56
2.9Wrap-Up60
3Introduction to Classes and Objects72
3.1Introduction73
3.2Classes, Objects, Methods and Instance Variables73
3.3Declaring a Class with a Method and Instantiating an Object of a Class75
3.4Declaring a Method with a Parameter79
3.5Instance Variables, set Methods and get Methods82
3.6Primitive Types vs. Reference Types87
3.7Initializing Objects with Constructors88
3.8Floating-Point Numbers and Type double91
3.9(Optional) GUI and Graphics Case Study: Using Dialog Boxes95
3.10Wrap-Up98
4Control Statements106
4.1Introduction107
4.2Algorithms107
4.3Pseudocode108
4.4Control Structures108
4.5if Single-Selection Statement111
4.6if...else Double-Selection Statement112
4.7while Repetition Statement117
4.8Formulating Algorithms: Counter-Controlled Repetition118
4.9Formulating Algorithms: Sentinel-Controlled Repetition123
4.10Formulating Algorithms: Nested Control Statements130
4.11Compound Assignment Operators136
4.12Increment and Decrement Operators137
4.13Primitive Types139
4.14(Optional) GUI and Graphics Case Study: Creating Simple Drawings140
4.15Wrap-Up145
5Control Statements: Part 2157
5.1Introduction158
5.2Essentials of Counter-Controlled Repetition158
5.3for Repetition Statement160
5.4Examples Using the for Statement164
5.5do...while Repetition Statement169
5.6switch Multiple-Selection Statement170
5.7break and continue Statements178
5.8Logical Operators180
5.9Structured Programming Summary186
5.10(Optional) GUI and Graphics Case Study: Drawing Rectangles and Ovals191
5.11Wrap-Up194
6Methods: A Deeper Look204
6.1Introduction205
6.2Program Modules in Java206
6.3Static Methods, static Fields and Class Math207
6.4Declaring Methods with Multiple Parameters210
6.5Notes on Declaring and Using Methods214
6.6Method Call Stack and Activation Records215
6.7Argument Promotion and Casting215
6.8Java API Packages217
6.9Case Study: Random-Number Generation219
6.9.1Generalized Scaling and Shifting of Random Numbers223
6.9.2Random-Number Repeatability for Testing and Debugging223
6.10Case Study: A Game of Chance (Introducing Enumerations)224
6.11Scope of Declarations229
6.12Method Overloading232
6.13(Optional) GUI and Graphics Case Study: Colors and Filled Shapes235
6.14Wrap-Up237
7Arrays252
7.1Introduction253
7.2Arrays253
7.3Declaring and Creating Arrays255
7.4Examples Using Arrays256
7.5Case Study: Card Shuffling and Dealing Simulation265
7.6Enhanced for Statement268
7.7Passing Arrays to Methods270
7.8Case Study: Class GradeBook Using an Array to Store Grades274
7.9Multidimensional Arrays278
7.10Case Study: Class GradeBook Using a Two-Dimensional Array283
7.11Variable-Length Argument Lists289
7.12Using Command-Line Arguments290
7.13(Optional) GUI and Graphics Case Study: Drawing Arcs292
7.14Wrap-Up295
8Classes and Objects: A Deeper Look316
8.1Introduction317
8.2Time Class Case Study318
8.3Controlling Access to Members321
8.4Referring to the Current Object's Members with the this Reference322
8.5Time Class Case Study: Overloaded Constructors325
8.6Default and No-Argument Constructors330
8.7Notes on Set and Get Methods331
8.8Composition332
8.9Enumerations334
8.10Garbage Collection and Method finalize338
8.11static Class Members339
8.12static Import344
8.13final Instance Variables345
8.14Software Reusability347
8.15Data Abstraction and Encapsulation348
8.16Time Class Case Study: Creating Packages349
8.17Package Access355
8.18(Optional) GUI and Graphics Case Study: Using Objects with Graphics355
8.19Wrap-Up360
9Object-Oriented Programming: Inheritance369
9.1Introduction370
9.2Superclasses and Subclasses371
9.3Protected Members373
9.4Relationship between Superclasses and Subclasses374
9.4.1Creating and Using a CommissionEmployee Class375
9.4.2Creating a BasePlusCommissionEmployee Class without Using Inheritance379
9.4.3Creating a CommissionEmployee-BasePlusCommissionEmployee Inheritance Hierarchy384
9.4.4CommissionEmployee-BasePlusCommissionEmployee Inheritance Hierarchy Using protected Instance Variables387
9.4.5CommissionEmployee-BasePlusCommissionEmployee Inheritance Hierarchy Using private Instance Variables393
9.5Constructors in Subclasses398
9.6Software Engineering with Inheritance404
9.7Object Class405
9.8(Optional) GUI and Graphics Case Study: Displaying Text and Images Using Labels407
9.9Wrap-Up409
10Object-Oriented Programming: Polymorphism413
10.1Introduction414
10.2Polymorphism Examples416
10.3Demonstrating Polymorphic Behavior417
10.4Abstract Classes and Methods420
10.5Case Study: Payroll System Using Polymorphism422
10.5.1Creating Abstract Superclass Employee423
10.5.2Creating Concrete Subclass SalariedEmployee426
10.5.3Creating Concrete Subclass HourlyEmployee427
10.5.4Creating Concrete Subclass CommissionEmployee429
10.5.5Creating Indirect Concrete Subclass BasePlusCommissionEmployee430
10.5.6Demonstrating Polymorphic Processing, Operator instanceof and Downcasting432
10.5.7Summary of the Allowed Assignments Between Superclass and Subclass Variables436
10.6Final Methods and Classes437
10.7Case Study: Creating and Using Interfaces438
10.7.1Developing a Payable Hierarchy439
10.7.2Declaring Interface Payable440
10.7.3Creating Class Invoice441
10.7.4Modifying Class Employee to Implement Interface Payable443
10.7.5Modifying Class SalariedEmployee for Use in the Payable Hierarchy445
10.7.6Using Interface Payable to Process Invoices and Employees Polymorphically447
10.7.7Declaring Constants with Interfaces448
10.7.8Common Interfaces of the Java API449
10.8(Optional) GUI and Graphics Case Study: Drawing with Polymorphism450
10.9Wrap-Up452
AOperator Precedence Chart456
A.1Operator Precedence456
BASCII Character Set458
CKeywords and Reserved Words459
DPrimitive Types460
ENumber Systems461
E.1Introduction462
E.2Abbreviating Binary Numbers as Octal and Hexadecimal Numbers465
E.3Converting Octal and Hexadecimal Numbers to Binary Numbers466
E.4Converting from Binary, Octal or Hexadecimal to Decimal466
E.5Converting from Decimal to Binary, Octal or Hexadecimal467
E.6Negative Binary Numbers: Two's Complement Notation469
FUnicode474
F.1Introduction474
F.2Unicode Transformation Formats475
F.3Characters and Glyphs476
F.4Advantages/Disadvantages of Unicode477
F.5Unicode Consortium's Web Site477
F.6Using Unicode479
F.7Character Ranges481
GUsing the Java API Documentation485
G.1Introduction485
G.2Navigating the Java API486
HCreating Documentation with javadoc495
H.1Introduction495
H.2Documentation Comments495
H.3Documenting Java Source Code496
H.4javadoc503
H.5Files Produced by javadoc504
ILabeled break and continue Statements507
I.1Introduction507
I.2Labeled break Statement507
I.3Labeled continue Statement508
JUsing the Debugger510
J.1Introduction511
J.2Breakpoints and the run, stop, cont and print Commands511
J.3The print and set Commands516
J.4Controlling Execution Using the step, step up and next Commands518
J.5The watch Command521
J.6The clear Command523
J.7Wrap-Up526
Index527

Customer Reviews

Average Review:

Write a Review

and post it to your social network

     

Most Helpful Customer Reviews

See all customer reviews >