Java, Java, Java, Object-Oriented Problem Solving / Edition 3

Java, Java, Java, Object-Oriented Problem Solving / Edition 3

5.0 1
by Ralph Morelli, Ralph Walde, Ralph Walde
     
 

ISBN-10: 0131474340

ISBN-13: 9780131474345

Pub. Date: 12/23/2005

Publisher: Prentice Hall

Functional and flexible, this guide takes an objects-first approach to Java programming and problem using games and puzzles. Updated to cover Java version 1.5 features, such as generic types, enumerated types, and the Scanner class. Offers independent introductions to both a command-line interface and a graphical user interface (GUI). Features coverage of Unified

Overview

Functional and flexible, this guide takes an objects-first approach to Java programming and problem using games and puzzles. Updated to cover Java version 1.5 features, such as generic types, enumerated types, and the Scanner class. Offers independent introductions to both a command-line interface and a graphical user interface (GUI). Features coverage of Unified Modeling Language (UML), the industry-standard, object-oriented design tool. Illustrates key aspects of Java with a collection of game and puzzle examples. Instructor and Student resources available online. For introductory computer programming students or professionals interested in learning Java.

Product Details

ISBN-13:
9780131474345
Publisher:
Prentice Hall
Publication date:
12/23/2005
Edition description:
REV
Pages:
880
Product dimensions:
7.50(w) x 9.11(h) x 1.58(d)

Table of Contents

Prefacexiii
0Computers, Objects, and Java1
0.1Welcome2
0.2What Is a Computer?2
0.3Networks, the Internet, and the World Wide Web3
0.4Why Study Programming?6
0.5Programming Languages6
0.6Why Java?8
0.7What Is Object-Oriented Programming?10
Chapter Summary18
Exercises20
1Java Program Design and Development23
1.1Introduction24
1.2Designing Good Programs24
1.3Designing a Riddle Program26
1.4Java Language Elements33
1.5Editing, Compiling, and Running a Java Program48
1.6From the Java Library: System and PrintStream52
Chapter Summary54
Solutions to Self-Study Exercises56
Exercises57
2Objects: Using, Creating, and Defining63
2.1Introduction64
2.2Using String Objects64
2.3Drawing Shapes with a Graphics Object (Optional)68
2.4Class Definition73
2.5CASE STUDY: Simulating a Two-Person Game78
2.6From the Java Library: java.util.Scanner91
Chapter Summary95
Solutions to Self-Study Exercises96
Exercises97
3Methods: Communicating with Objects103
3.1Introduction104
3.2Passing Information to an Object104
3.3Constructor Methods111
3.4Retrieving Information from an Object115
3.5Passing a Value and Passing a Reference118
3.6Flow of Control: Control Structures121
3.7Testing an Improved OneRowNim129
3.8From the Java Library: java.lang.Object133
3.9Object-Oriented Design: Inheritance and Polymorphism135
3.10Drawing Lines and Defining Graphical Methods (Optional)136
Chapter Summary139
Solutions to Self-Study Exercises140
Exercises142
4Input/Output: Designing the User Interface149
4.1Introduction150
4.2The Use Interface150
4.3A Command-Line Interface151
4.4A Graphical User Interface (GUI)159
4.5CASE STUDY: The One-Row Nim Game175
4.6From the Java Library: java.io.File and File Input (Optional)183
Chapter Summary186
Solutions to Self-Study Exercises188
Exercises190
5Java Data and Operators195
5.1Introduction196
5.2Boolean Data and Operators197
5.3Numeric Data and Operators204
5.4From the Java Library: java.lang.Math215
5.5Numeric Processing Examples216
5.6From the Java Library: java.text.NumberFormat228
5.7Character Data and Operators230
5.8Example: Character Conversions233
5.9Problem Solving = Representation + Action236
Chapter Summary236
Solutions to Self-Study Exercises238
Exercises242
6Control Structures249
6.1Introduction250
6.2Flow of Control: Repetition Structures250
6.3Counting Loops251
6.4Example: Car Loan260
6.5Graphics Example: Drawing a Checkerboard262
6.6Conditional Loops266
6.7Example: Computing Averages272
6.8Example: Data Validation275
6.9Principles of Loop Design277
6.10The switch Multiway Selection Structure278
6.11Object-Oriented Design: Structured Programming282
Chapter Summary290
Solutions to Self-Study Exercises291
Exercises298
7Strings and String Processing305
7.1Introduction306
7.2String Basics306
7.3Finding Things within a String313
7.4Example: Keyword Search315
7.5From the Java Library: java.lang.StringBuffer317
7.6Retrieving Parts of Strings320
7.7Example: Processing Names and Passwords322
7.8Processing Each Character in a String323
7.9Comparing Strings326
7.10From the Java Library: java.util.StringTokenizer332
7.11Handling Text in a Graphics Context (Optional)334
Chapter Summary340
Solutions to Self-Study Exercises341
Exercises344
8Inheritance and Polymorphism349
8.1Introduction350
8.2Java's Inheritance Mechanism350
8.3Abstract Classes, Interfaces, and Polymorphism359
8.4Example: A Toggle Button365
8.5Example: The Cipher Class Hierarchy368
8.6CASE STUDY: A Two-Player Game Hierarchy375
8.7Principles of Object-Oriented Design396
Chapter Summary397
Solutions to Self-Study Exercises398
Exercises400
9Arrays and Array Processing405
9.1Introduction406
9.2One-Dimensional Arrays406
9.3Simple Array Examples413
9.4Example: Counting Frequencies of Letters416
9.5Array Algorithms: Sorting420
9.6Array Algorithms: Searching426
9.7Two-Dimensional Arrays430
9.8Multidimensional Arrays (Optional)437
9.9Object-Oriented Design: Polymorphic Sorting (Optional)439
9.10From the Java Library: java. lang. Vector443
9.11CASE STUDY: An N-Player Computer Game444
9.12A GUI-Based Game (Optional Graphics)452
Chapter Summary459
Solutions to Self-Study Exercises460
Exercises465
10Exceptions: When Things Go Wrong471
10.1Introduction472
10.2Handling Exceptional Conditions472
10.3Java's Exception Hierarchy474
10.4Handling Exceptions within a Program478
10.5Error Handling and Robust Program Design488
10.6Creating and Throwing Your Own Exceptions497
10.7From the Java Library: javax.swing.JOptionPane501
Chapter Summary503
Solutions to Self-Study Exercises505
Exercises507
11Files and Streams: Input/Output Techniques511
11.1Introduction512
11.2Streams and Files512
11.3CASE STUDY: Reading and Writing Text Files518
11.4The File Class530
11.5Example: Reading and Writing Binary Files533
11.6Object Serialization: Reading and Writing Objects542
11.7From the Java Library: javax.swing.JFileChooser547
11.8Using File Data in Programs548
Chapter Summary551
Solutions to Self-Study Exercises552
Exercises553
12Recursive Problem Solving557
12.1Introduction558
12.2Recursive Definition561
12.3Recursive String Methods564
12.4Recursive Array Processing574
12.5Example: Drawing (Recursive) Fractals580
12.6Object-Oriented Design: Tail Recursion584
12.7Object-Oriented Design: Recursion or Iteration?586
12.8From the Java Library: javax.swing.JComboBox588
Chapter Summary594
Solutions to Self-Study Exercises595
Exercises599
13Graphical User Interfaces603
13.1Introduction604
13.2Java GUIs: From AWT to Swing604
13.3The Swing Component Set607
13.4Object-Oriented Design: Model-View-Controller Architecture607
13.5The Java Event Model609
13.6CASE STUDY: Designing a Basic GUI614
13.7Containers and Layout Managers627
13.8Checkboxes, Radio Buttons, and Borders633
13.9Menus and Scroll Panes641
Chapter Summary650
Solutions to Self-Study Exercises651
Exercises653
14Threads and Concurrent Programming657
14.1Introduction658
14.2What Is a Thread?658
14.3From the Java Library: java.lang.Thread662
14.4Thread States and Life Cycle668
14.5Using Threads to Improve Interface Responsiveness670
14.6CASE STUDY: Cooperating Threads678
14.7CASE STUDY: The Game of Pong693
Chapter Summary700
Solutions to Self-Study Exercises702
Exercises704
15Sockets and Networking707
15.1Introduction708
15.2An Overview of Networks708
15.3Using Network Resources from an Applet714
15.4From the Java Library: java.net.URL715
15.5The Slide-Show Applet717
15.6Using Network Resources from an Application722
15.7Client/Server Communication via Sockets732
15.8CASE STUDY: Generic Client/Server Classes736
15.9Playing One-Row Nim Over the Network745
15.10Java Network Security Restrictions752
15.11Java Servlets and Java Server Pages753
Chapter Summary762
Solutions to Self-Study Exercises763
Exercises765
16Data Structures: Lists, Stacks, and Queues767
16.1Introduction768
16.2The Linked List Data Structure768
16.3Object-Oriented Design: The List Abstract Data Type (ADT)780
16.4The Stack ADT785
16.5The Queue ADT788
16.6From the Java Library: The Java Collections Framework and Generic Types791
16.7Using the Set and Map Interfaces795
16.8The Binary Search Tree Data Structure799
Chapter Summary801
Solutions to Self-Study Exercises803
Exercises806
ACoding Conventions811
BThe Java Development Kit819
CThe ASCII and Unicode Character Sets828
DJava Keywords829
EOperator Precedence Hierarchy830
FJava Inner Classes832
GJava Autoboxing and Enumeration837
HJava and UML Resources841
Index843

Customer Reviews

Average Review:

Write a Review

and post it to your social network

     

Most Helpful Customer Reviews

See all customer reviews >

Java, Java, Java, Object-Oriented Problem Solving 5 out of 5 based on 0 ratings. 1 reviews.
Guest More than 1 year ago
This is a review of the 3RD EDITION, published December 2005. The book starts from scratch. You do not have to know anything about Java. What Morelli and Walde offer is an education that emphasises an object oriented programming mentality, from the very start. The text shows how Java enforces a strict OO coding. Unlike C++, for example, which was bolted onto C as a superset, and accordingly has to accept (endure would be a better word) procedural C code as valid. So thoroughly do the authors want you to learn OO programming that there is no mention of the alternative of procedural programming in other languages! They don't want to confuse the reader, who is probably assumed to be new to programming in general, and not just Java. Now the book also holds true to its claim in the title of 'Problem Solving'. It causes the book to be relatively weak in explaining how to write a user interface with Java widgets. Yes, there is a couple of chapters on this. But the topic is deprecated. The book's clear strength is in the majority of its space being devoted to tackling various problems. Chosen so that you don't need a fancy UI over them. The problems can be handled as pure computations, with perhaps a minimal I/O and stdout user interface. Of course, the problems were also chosen so that the authors could demonstrate solutions that take advantage of OO design. An important extra benefit is that you get acquainted with the various Java collection classes. These come with the standard Java distribution. They implement key ideas in computer science, like lists, queues, stacks, arrays and hash tables. Professional Java programmers use these extensively. They have a lot of functionality, that is stable and well-tested by Sun itself. These classes address both the OO and problem solving themes of the book. Being Java classes, they are inherently objects to be used in an OO manner. But the sheer utility of these for handling many problems is also a good education for you.