作者:empty 页数:756 出版社:empty |
ce rms sion should be obtinedfrunthepubierpoct say pro lib it edtereodutonxuraseinaet real surtem.or trans mix sion in any form or by amy means, cl oct runic, mechanical pbo to copying.re coed ing.or likewise.Toshain petn is aunt Htousematealsfomhiswock.pleaeesabmitawntle request o Pearson Hi herE i uca ionThe an shur and publier of this book have us cd their best efftsimprepaigtuybouk.The sce furs include thedevelope neut, research.and testing of thc the o cies and programs to de tur mine their effectiveness.The autbor andpublisher make now arran ly of any kind.expressed or implied.with reg and to these program sur the documentationcora elit is book.Th cats w and pub ser shall mtbeltleieyeventtoekiea lures x quent aldamages mcoanccinwihuranino to.the fms ng.peo man c.ruse f these pro ramsLibrary of Cong ness Cataloging-in-Puh lication Data on fle.
This version is designed for an introductory programming course, commonly known as comprehensive versionCSI.This version contains the first twenty chapters in the comprehensive version.This book uses the fundamentals-first approach and teaches programming cone e pts andtechniques in a problem-driven way.The fundamentals-first approach introduces basie programming concepts and techniquesfundamentals firsthe for e obj eets and classes.My own experience, confirmed by the experiences of many col-leagues, demonstrates that new programmers in order to suce eed must leam basic logic andfundamental programming techniques such as loops and stepwise refinement.The fund amental cone e pts and techniques of loops, methods, and arrays are the foundation for pro-gramming.Bul dig the foundation prepares student stole am object oriented programming,GUI, database, and Web programming-Problem-driven means focused on problem-solving rather than syntax.We make intro due-proble in-driventory programming interesting by using interesting problems.The central thread of this hookis on sol vig problems.Approp nate syntax and brary are introduced to support the wingof a program for solving the problems.To support teaching programming in a problem-driven way, the book provides a wide variety of problems at various levels of difficulty tomotivate students.In order to appeal to students in all majors, the problems cover many appli-e ation areas in math, science, business, financials, gaming.animation.and multimediaWhat's New in This Edition?
1Inteductionfo Computers, Prog va ms,
and Java
2 Elementary Programming
3 Selections
Loops
5 Methods
6 Single-Di mens tonal Arrays
7 Multidimensional Arrays
8 objects and Classes
9StrngsandTextt/o
10Thmkingin Objects
11 Inheritance and Polymorphism
12GUIBastes
13 Exception Handling
14 Abstract Classes and Interfaces
15 Graphics
18 Applets and Multimedia
19 Binary 1/O
20 Recursion
APPENDIXES
A Java Keywords
B The ASCII Character Set
C Operator Pre ec dence Chart
D Java Modifiers
ESpecial Floating-Point Values
F Number Systems
INDEX
Chapter 4
was croatodwthSpiPDPferiNET
Chapter l
Chapter 2
Chapter 3
Introduction to Computers, Programs,
and Java
Introduction
What Is a Computer!
Programs
Operating Systems
Java.WorldWide Web.and Beyond
The Java Language Specification, API.JDK, and IDE
A Simple Java Program
Creating.Compil ng, and Executing a Java Program
Assignment Statements and Assignment Expressions
Selections
1.9(GUI) Displaying Text in a Message DialogBox
Elementary Programming
2.1
Introduction
12Writing Simple Programs
2.3Reading Input from the Console
2.4Identifiers
2.5Variables
2.7Named Constants
2.8Numen c DataTypes and Operations
2.9Problem:Displaying the Current Time
2.10 Shorthand Operators
z.11Numeric Type Conversions
2.12Problem:Computing Loan Payments
2.13Character DataType and Opera ions
Z.14Problem:Counting Monetary Units
Z.15The StringType
2.6Programming Style and Documentation
2.17Programming Errors
2.18(GUI) Getting Input from Input Dialogs
3.1Introduction
3.2 boolean DataType
3.3Problem:A Simple Math Learning Tool
3.4if Statements
Contents xvii
3.5 Problem:Guessing Birthdays
3.6Two-Way if Statements
3.7Nested if Statements
Common Errors in Selection Statements
3.9Problem:An Improved Math Learning Tool
3.10 Problem:Computing Body Mass Index
3.11Problem:Computing Taxes
3.12 Logical Operators
3.13 Problem:Determining Leap Year
3.14 Problem:Lottery
3.15switch Statements
3.16Conditional Expressions
3.17Formatting Console Output
3.18 Operator Precedence and Associativity
3.19(GUI) Confirmation Dialogs
Loops
4.1Introduction
4.2The while Loop
4.3The do-while Loop
4.4The for Loop
4.5Which Loop to Use?
4.6 Nested Loops
4.7Minimizing Numeric Errors
4.8CaseStudies
4.9 Keywords break and continue
4.10(GUI) Controlling a Loop wth a Confirmation Dialog
Methods
5.1Introduction
5.2Defining a Method
5.3Calling a Method
5.4void Method Example
5.5Passing Parameters by Values
5.6Modularizing Code
5.7Problem:Converting Decimals to Hexadecimal s
5.8Overloading Methods
5.9The Scope of Variables
5.10The Math Class
5.11Case Study:Generating Random Characters
5.12 Method Abstraction and Stepwise Refinement
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Single-Dimensional Arrays
Introduction
Array Basics
Problem:Lotto Numbers
Problem:Deck of Cards
Copying Arrays
Passing Arrays to Methods
Re tum ning an Array from a Method
Variable-Length Argument Lists
Searching Arrays
Sorting Arrays
The Arrays Class
Multidimensional Arrays
Introduction
Two-Dimensional Array Basics
Pr acessing Two-Dimensional Arrays
Passing Two-Dimensional Arrays to Methods
Problem:GradingaMultiple-ChaiceTest
Problem:Finding a Closest Pair
Problem:Sudoku
Multidimensional Arrays
Objects and Classes
Introduction
Defining Classes for Objects
Example:Defining Classes and Creating Objects
Constructing Objects Using Constructors
Accessing Objects via Reference Variables
Using Classes from the Java Library
Static Variables.Constants.and Methods
8.8Visibity Modifiers
8.9 DataField Encapsulation
8.10 Passing Objects to Methods
Array of Objects
Strings and Text I/O
Introduction
The String Class
The Character Class
Contents xix
9.4 The StringBuilder/StringBuffer Class
9.5Command-Line Arguments
9.6The File Class
9.7 File Input and Output
9.8(GUI) File Dialogs
10.1Introduction
10.2Immutable Objects and Classes
10.3The Scope of Variables
10.4The this Reference
10.5Class Abstraction and Encapsulation
10.6Object-Oriente