Introduction to Java Programming, Brief Version [with Access Code] [Tenth edition. Brief version] 9780133592207, 1292078561, 9781292078564, 0133592200

ALERT: Before you purchase, check with your instructor or review your course syllabus to ensure that you select the corr

605 122 62MB

English Pages xvii, 780 pages: illustrations (some color; 26 cm [802] Year 2014;2015

Report DMCA / Copyright

DOWNLOAD FILE

Introduction to Java Programming, Brief Version [with Access Code] [Tenth edition. Brief version]
 9780133592207, 1292078561, 9781292078564, 0133592200

Table of contents :
Cover......Page 1
Title......Page 3
Copyright......Page 4
Chapter 1 Introduction to Computers, Programs,and Java......Page 21
1.2 What Is a Computer?......Page 22
1.3 Programming Languages......Page 27
1.4 Operating Systems......Page 29
1.5 Java, the World Wide Web, and Beyond......Page 30
1.6 The Java Language Specification, API, JDK, and IDE......Page 31
1.7 A Simple Java Program......Page 32
1.8 Creating, Compiling, and Executing a Java Program......Page 35
1.9 Programming Style and Documentation......Page 38
1.10 Programming Errors......Page 40
1.11 Developing Java Programs Using NetBeans......Page 43
1.12 Developing Java Programs Using Eclipse......Page 45
Chapter 2 Elementary Programming......Page 53
2.2 Writing a Simple Program......Page 54
2.3 Reading Input from the Console......Page 57
2.4 Identifiers......Page 59
2.5 Variables......Page 60
2.6 Assignment Statements and Assignment Expressions......Page 61
2.7 Named Constants......Page 63
2.9 Numeric Data Types and Operations......Page 64
2.10 Numeric Literals......Page 68
2.11 Evaluating Expressions and Operator Precedence......Page 70
2.12 Case Study: Displaying the Current Time......Page 72
2.13 Augmented Assignment Operators......Page 74
2.14 Increment and Decrement Operators......Page 75
2.15 Numeric Type Conversions......Page 76
2.16 Software Development Process......Page 79
2.17 Case Study: Counting Monetary Units......Page 83
2.18 Common Errors and Pitfalls......Page 85
Chapter 3 Selections......Page 95
3.2 boolean Data Type......Page 96
3.3 if Statements......Page 98
3.4 Two-Way if-else Statements......Page 100
3.5 Nested if and Multi-Way if-else Statements......Page 101
3.6 Common Errors and Pitfalls......Page 103
3.7 Generating Random Numbers......Page 107
3.8 Case Study: Computing Body Mass Index......Page 109
3.9 Case Study: Computing Taxes......Page 110
3.10 Logical Operators......Page 113
3.11 Case Study: Determining Leap Year......Page 117
3.12 Case Study: Lottery......Page 118
3.13 switch Statements......Page 120
3.14 Conditional Expressions......Page 123
3.15 Operator Precedence and Associativity......Page 124
3.16 Debugging......Page 126
Chapter 4 Mathematical Functions, Characters,and Strings......Page 139
4.2 Common Mathematical Functions......Page 140
4.3 Character Data Type and Operations......Page 145
4.4 The String Type......Page 150
4.5 Case Studies......Page 159
4.6 Formatting Console Output......Page 165
Chapter 5 Loops......Page 177
5.2 The while Loop......Page 178
5.3 The do-while Loop......Page 188
5.4 The for Loop......Page 190
5.5 Which Loop to Use?......Page 194
5.6 Nested Loops......Page 196
5.7 Minimizing Numeric Errors......Page 198
5.8 Case Studies......Page 199
5.9 Keywords break and continue......Page 204
5.10 Case Study: Checking Palindromes......Page 207
5.11 Case Study: Displaying Prime Numbers......Page 208
Chapter 6 Methods......Page 223
6.2 Defining a Method......Page 224
6.3 Calling a Method......Page 226
6.4 void Method Example......Page 229
6.5 Passing Arguments by Values......Page 232
6.6 Modularizing Code......Page 235
6.7 Case Study: Converting Hexadecimals to Decimals......Page 237
6.8 Overloading Methods......Page 239
6.9 The Scope of Variables......Page 242
6.10 Case Study: Generating Random Characters......Page 243
6.11 Method Abstraction and Stepwise Refinement......Page 245
Chapter 7 Single-Dimensional Arrays......Page 265
7.2 Array Basics......Page 266
7.3 Case Study: Analyzing Numbers......Page 273
7.4 Case Study: Deck of Cards......Page 274
7.5 Copying Arrays......Page 276
7.6 Passing Arrays to Methods......Page 277
7.7 Returning an Array from a Method......Page 280
7.8 Case Study: Counting the Occurrences of Each Letter......Page 281
7.9 Variable-Length Argument Lists......Page 284
7.10 Searching Arrays......Page 285
7.11 Sorting Arrays......Page 289
7.12 The Arrays Class......Page 290
7.13 Command-Line Arguments......Page 292
Chapter 8 Multidimensional Arrays......Page 307
8.2 Two-Dimensional Array Basics......Page 308
8.3 Processing Two-Dimensional Arrays......Page 311
8.4 Passing Two-Dimensional Arrays to Methods......Page 313
8.5 Case Study: Grading a Multiple-Choice Test......Page 314
8.6 Case Study: Finding the Closest Pair......Page 316
8.7 Case Study: Sudoku......Page 318
8.8 Multidimensional Arrays......Page 321
Chapter 9 Objects and Classes......Page 341
9.2 Defining Classes for Objects......Page 342
9.3 Example: Defining Classes and Creating Objects......Page 344
9.4 Constructing Objects Using Constructors......Page 349
9.5 Accessing Objects via Reference Variables......Page 350
9.6 Using Classes from the Java Library......Page 354
9.7 Static Variables, Constants, and Methods......Page 357
9.8 Visibility Modifiers......Page 362
9.9 Data Field Encapsulation......Page 364
9.10 Passing Objects to Methods......Page 367
9.11 Array of Objects......Page 371
9.12 Immutable Objects and Classes......Page 373
9.13 The Scope of Variables......Page 375
9.14 The this Reference......Page 376
Chapter 10 Object-Oriented Thinking......Page 385
10.2 Class Abstraction and Encapsulation......Page 386
10.3 Thinking in Objects......Page 390
10.4 Class Relationships......Page 393
10.5 Case Study: Designing the Course Class......Page 396
10.6 Case Study: Designing a Class for Stacks......Page 398
10.7 Processing Primitive Data Type Values as Objects......Page 400
10.8 Automatic Conversion between Primitive Typesand Wrapper Class Types......Page 403
10.9 The BigInteger and BigDecimal Classes......Page 404
10.10 The String Class......Page 406
10.11 The StringBuilder and StringBuffer Classes......Page 412
Chapter 11 Inheritance and Polymorphism......Page 429
11.2 Superclasses and Subclasses......Page 430
11.3 Using the super Keyword......Page 436
11.4 Overriding Methods......Page 439
11.5 Overriding vs. Overloading......Page 440
11.6 The Object Class and Its toString() Method......Page 442
11.7 Polymorphism......Page 443
11.8 Dynamic Binding......Page 444
11.9 Casting Objects and the instanceof Operator......Page 447
11.10 The Object’s equals Method......Page 451
11.11 The ArrayList Class......Page 452
11.12 Useful Methods for Lists......Page 458
11.13 Case Study: A Custom Stack Class......Page 459
11.14 The protected Data and Methods......Page 460
11.15 Preventing Extending and Overriding......Page 462
Chapter 12 Exception Handling and Text I/O......Page 469
12.2 Exception-Handling Overview......Page 470
12.3 Exception Types......Page 475
12.4 More on Exception Handling......Page 478
12.5 The finally Clause......Page 486
12.6 When to Use Exceptions......Page 487
12.7 Rethrowing Exceptions......Page 488
12.8 Chained Exceptions......Page 489
12.9 Defining Custom Exception Classes......Page 490
12.10 The File Class......Page 493
12.11 File Input and Output......Page 496
12.12 Reading Data from the Web......Page 502
12.13 Case Study: Web Crawler......Page 504
Chapter 13 Abstract Classes and Interfaces......Page 515
13.2 Abstract Classes......Page 516
13.3 Case Study: the Abstract Number Class......Page 521
13.4 Case Study: Calendar and GregorianCalendar......Page 523
13.5 Interfaces......Page 526
13.6 The Comparable Interface......Page 529
13.7 The Cloneable Interface......Page 533
13.8 Interfaces vs. Abstract Classes......Page 537
13.9 Case Study: The Rational Class......Page 540
13.10 Class Design Guidelines......Page 545
Chapter 14 JavaFX Basics......Page 555
14.3 The Basic Structure of a JavaFX Program......Page 556
14.4 Panes, UI Controls, and Shapes......Page 559
14.5 Property Binding......Page 562
14.6 Common Properties and Methods for Nodes......Page 565
14.7 The Color Class......Page 566
14.8 The Font Class......Page 567
14.9 The Image and ImageView Classes......Page 569
14.10 Layout Panes......Page 572
14.11 Shapes......Page 580
14.12 Case Study: The ClockPane Class......Page 592
Chapter 15 Event-Driven Programming and Animations......Page 605
15.1 Introduction......Page 606
15.2 Events and Event Sources......Page 608
15.3 Registering Handlers and Handling Events......Page 609
15.4 Inner Classes......Page 613
15.5 Anonymous Inner Class Handlers......Page 614
15.6 Simplifying Event Handling Using Lambda Expressions......Page 617
15.7 Case Study: Loan Calculator......Page 620
15.8 Mouse Events......Page 622
15.9 Key Events......Page 623
15.10 Listeners for Observable Objects......Page 626
15.11 Animation......Page 628
15.12 Case Study: Bouncing Ball......Page 636
Chapter 16 JavaFX UI Controls and Multimedia......Page 649
16.2 Labeled and Label......Page 650
16.3 Button......Page 652
16.4 CheckBox......Page 654
16.5 RadioButton......Page 657
16.6 TextField......Page 659
16.7 TextArea......Page 661
16.8 ComboBox......Page 664
16.9 ListView......Page 667
16.10 ScrollBar......Page 671
16.11 Slider......Page 674
16.12 Case Study: Developing a Tic-Tac-Toe Game......Page 677
16.13 Video and Audio......Page 682
16.14 Case Study: National Flags and Anthems......Page 685
Chapter 17 Binary I/O......Page 697
17.2 How Is Text I/O Handled in Java?......Page 698
17.3 Text I/O vs. Binary I/O......Page 699
17.4 Binary I/O Classes......Page 700
17.5 Case Study: Copying Files......Page 711
17.6 Object I/O......Page 712
17.7 Random-Access Files......Page 717
Chapter 18 Recursion......Page 725
18.2 Case Study: Computing Factorials......Page 726
18.3 Case Study: Computing Fibonacci Numbers......Page 729
18.4 Problem Solving Using Recursion......Page 732
18.5 Recursive Helper Methods......Page 734
18.6 Case Study: Finding the Directory Size......Page 737
18.7 Case Study: Tower of Hanoi......Page 739
18.8 Case Study: Fractals......Page 742
18.9 Recursion vs. Iteration......Page 746
18.10 Tail Recursion......Page 747
Appendix AJava Keywords......Page 759
Appendix B The ASCII Character Set......Page 760
Appendix C Operator Precedence Chart......Page 762
Appendix D Java Modifiers......Page 764
Appendix E Special Floating-Point Values......Page 766
Appendix F Number Systems......Page 767
Appendix G Bitwise Operations......Page 771
Appendix H Regular Expressions......Page 772
Appendix I Enumerated Types......Page 777
A......Page 783
B......Page 784
C......Page 785
D......Page 787
F......Page 788
H......Page 789
I......Page 790
J......Page 791
L......Page 792
M......Page 793
O......Page 794
P......Page 795
R......Page 796
S......Page 797
T......Page 799
W......Page 800

Polecaj historie