Cover image for Java programming for the absolute beginner
Title:
Java programming for the absolute beginner
Personal Author:
Edition:
2nd ed.
Publication Information:
Boston, MA : Thomson Course Technology PTR, 2007
ISBN:
9781598632750

Available:*

Library
Item Barcode
Call Number
Material Type
Item Category 1
Status
Searching...
30000010124745 QA76.73.J38 F594 2007 Open Access Book Book
Searching...

On Order

Summary

Summary

Java Programming for the Absolute Beginner provides you with an introduction to Java that allows you to learn the fundamentals of object-oriented programming while becoming acquainted with many of the core features of Java. This book starts with the assumption that you have not previously written a computer program. It then walks you through the creation of a variety of games and applications. After you have your footing with the basics, you learn to develop your own systems of classes, and by the end of the book, you are working with many of Java's Graphical User Interface (GUI) features and developing a desktop Windows application. This book provides a solid introduction for anyone desiring a relaxed, fully guided tour of the fundamentals of Java, programming, and the objectoriented approach to application development.


Table of Contents

Chapter 1 Getting Startedp. 1
The HelloWeb Appletp. 2
What Is Java?p. 2
Java Is a Programming Languagep. 3
Java Is Platform Independentp. 4
Java Is Object Orientedp. 5
Classes and Objectsp. 6
Attributes and Methodsp. 6
Why Learn Java?p. 6
Pathways to Learning Javap. 7
Where to Startp. 7
Installing and Setting Up the JDKp. 8
Accessing the Sun Sitep. 8
The JDK Installation Executablep. 9
Starting Your Windows Installationp. 9
Windows Installation and Setup Continuedp. 10
Verifying and Copying the Path to Your JREp. 10
Setting the Path Variablep. 11
Writing Your First Programp. 11
Setting Up to Work with DOSp. 11
DOS Commandsp. 14
Creating a Hello World Programp. 16
HelloWorld Syntax Basicsp. 17
Compiling the Hello World Programp. 20
Running the Hello World Programp. 21
Writing Your First Appletp. 23
Applet Codep. 23
Compiling the Applet Codep. 25
Writing an HTML File for an Appletp. 26
Using the Applet Viewerp. 27
Running Your Applet in the Browserp. 28
Summaryp. 29
Chapter 2 Variables, Data Types, and Simple IOp. 31
The Name Game Applicationp. 32
Variables and Data Typesp. 32
Primitive Data Typesp. 33
Understanding Literalsp. 35
Casting and Type Promotionp. 36
Strings and Character Escape Codesp. 37
Naming Variablesp. 39
Conventionsp. 40
Assignment and Initializationp. 41
Working with Numbersp. 45
Operators and Operandsp. 45
How to Do Mathp. 46
The TipAdder Programp. 46
Formatting Decimal Precisionp. 48
Operator Precedencep. 51
Getting User Inputp. 53
The BufferedReader Classp. 55
The try...catch Blockp. 57
Parsing Strings to Numbersp. 58
Accepting Command-Line Argumentsp. 62
Strings and String Operationsp. 64
The Name Gamep. 66
Summaryp. 69
Chapter 3 The Fortune Teller: Random Numbers, Conditions, and Arraysp. 71
The Fortune Teller Applicationp. 72
Generating Random Numbersp. 72
The Math Classp. 73
The Random Classp. 75
Generating Different Types of Random Numbersp. 76
Seeding Valuesp. 78
More of the Math Classp. 81
Flow and Selectionp. 85
Conditions and Conditional Operatorsp. 86
Single-Entry Selectionp. 87
The Ternary Operatorp. 91
Boolean Operatorsp. 91
The if...else Statementp. 94
The Temperature Conversion Programp. 95
The if...else if...else Statementp. 97
The switch Structurep. 100
The Dice Roller Programp. 102
Arraysp. 104
Declaring Arraysp. 106
Assigning Values to Arraysp. 107
Combined Declaration and Initializationp. 108
Accessing Array Valuesp. 108
The Array Use Programp. 109
The Fortune Teller Revisitedp. 112
Summaryp. 115
Chapter 4 Repetition Statements and Exception Handlingp. 117
The Guess-a-Number Applicationp. 118
Flow as Repetitionp. 118
The for Statementp. 119
The Racer Programp. 120
Basic Repetition Activitiesp. 122
Redefinition of Control Variablesp. 123
Control and Unary Operatorsp. 124
Variations on Intervalsp. 126
Compound Assignment Operatorsp. 128
Variations on the Use of the for Structurep. 131
Nested Repetition Blocksp. 134
The while Statementp. 138
The do...while Statementp. 141
The continue and break Keywordsp. 144
Using throw and finally with try...catch Structuresp. 149
Back to Guessing a Numberp. 154
Summaryp. 158
Chapter 5 Object-Oriented Programmingp. 161
Object-Oriented Conceptsp. 162
States and Attributesp. 162
Behaviorsp. 162
Attributes and Methodsp. 164
Picturing Classesp. 165
Implementing a Classp. 167
Defining Attributesp. 169
Defining Methodsp. 169
Default Constructorsp. 171
Overloaded Constructorsp. 172
Creating a Test Driver Classp. 174
Encapsulationp. 178
Scope Considerationsp. 179
The Scope and ScopeTest Classesp. 180
More on Methodsp. 184
Method Overloadingp. 184
Method Signatures and Return Operationsp. 186
Assignments and Cascading Callsp. 188
Points of Returnp. 189
Static Methods and Attributesp. 190
More on Constructors and the this Keywordp. 193
Compositionp. 195
The Card Classp. 197
The CardDeck Classp. 201
Testing the Associated Classesp. 205
Trumpp. 207
Summaryp. 211
Chapter 6 Building a Class Hierarchyp. 213
Software Reusabilityp. 214
Specialization and Generalizationp. 215
Creating a Class Hierarchyp. 218
Concrete Classesp. 220
A Concrete Base Classp. 221
Testing the Base Car Classp. 224
Second-Tier Classesp. 226
Third-Tier Classesp. 235
Method Overridingp. 239
The Sedan Class and Overridingp. 241
Testing the Sedan Classp. 243
Finalizationp. 245
Polymorphismp. 246
ChildCartp. 248
DieselElectricp. 250
GasElectricp. 252
Using Polymorphic Optionsp. 254
Summaryp. 258
Chapter 7 Abstract Classes and Interfacesp. 261
Abstract Classesp. 262
Abstract Methodsp. 263
Picturing Abstract Classes and Methodsp. 264
Using Abstraction in the Car Hierarchyp. 267
The Car Class as an Abstract Classp. 267
The Economy Class as an Abstract Classp. 271
Creating a Concrete Classp. 272
Other Concrete and Abstract Classesp. 274
Polymorphic Uses of Abstract Data Typesp. 276
References and Identifiersp. 276
References and Collectionsp. 277
Interfacesp. 282
Multiple Inheritance and the Use of Interfacesp. 285
Picturing Interfacesp. 286
Creating a Test Applicationp. 287
Implementing a GUI Applicationp. 287
Accommodating Window Closing Eventsp. 293
Inner Classesp. 296
Explicitly Named Inner Classesp. 296
Inner Anonymous and Final Classesp. 301
Summaryp. 304
Chapter 8 Graphic User Interface Activitiesp. 305
Setting Up a Windowp. 306
Lab View Ap. 306
Layout Managementp. 312
Other Layout Managersp. 315
Pluggable Look and Feelp. 317
Adding Menu Featuresp. 318
Arrays and Patternsp. 321
Lab View Bp. 322
Event Handlingp. 331
The Handlerp. 332
Associating Events with Menu Itemsp. 333
Identifying and Processing Messagesp. 333
JOptionPane Dialogsp. 335
Window Location Using the Java Toolkitp. 340
Use of a JLabel Object for a Status Barp. 342
Summaryp. 343
Chapter 9 Refactoring and Data Containersp. 345
Custom Dialogs and the Lab View Applicationp. 346
Refactoring and Software Patternsp. 346
Models and Viewsp. 348
Refactoring the showElements() Methodp. 349
Implementing the Elements Classp. 351
Hashtablep. 359
Hashtable Construction Activitiesp. 361
Tokenizing a Stringp. 366
Enumerationp. 369
ArrayListp. 370
String and StringBufferp. 373
Glyph Problemsp. 374
Tabsp. 375
Cleaning Up Datap. 375
The Inner Class and the finalize Methodp. 376
Mutator and Accessor Methods of the Elements Classp. 377
Exceptionsp. 377
Summaryp. 378
Chapter 10 Extending Applicationsp. 381
Using Dialogs to Extend the Applicationp. 382
Child Windowsp. 384
The JDialog Windowp. 385
JDialog Constructionp. 391
Disposal and Initializationp. 391
The Box Layout Managerp. 392
Fontsp. 393
Lab View Menu Considerationsp. 394
An Abstract Primary Dialogp. 397
Mouse Drawing and Graphicsp. 400
Input/Output Operationsp. 407
Writing to a Filep. 412
Reading from a Filep. 413
Reading Information for a Help Dialogp. 414
The TableMaker Classp. 417
Layout for the Dialogp. 427
Event Processingp. 428
Processing Detailsp. 430
Other Concernsp. 431
Summaryp. 432
Appendix ConTEXT for Javap. 435
Setting Up an Editor for Javap. 435
Obtaining ConTEXTp. 436
Installing ConTEXTp. 437
Setting ConTEXT Optionsp. 441
Accessing Your Java Filesp. 442
Selecting the Highlighter for Javap. 443
Setting Up the Highlighterp. 443
Setting Up Associationsp. 443
Setting the Backup Directoryp. 446
Word Wrap and the Rulerp. 447
Setting the Function Keysp. 447
Associating F9 with the javac Commandp. 447
Testing F9p. 448
Associating F10 with the java Commandp. 449
Testing F10p. 452
Indexp. 453