Guide to Java: a concise introduction to programming 9781447163169, 9781447163176, 1447163168, 1447163176

Seeking to learn quickly how to program in Java without prior experience? ThisGuide to Javapresents a focused and access

325 111 1MB

English Pages XIII, 358 pagina's: illustraties; 24 cm [363] Year 2014

Report DMCA / Copyright

DOWNLOAD PDF FILE

Table of contents :
Need......Page 6
Overview of the Chapters......Page 7
Audience......Page 8
Feedback......Page 9
Contents......Page 10
1.1 Introduction......Page 15
1.2 Java Skeleton......Page 19
1.3 Variables and Constants......Page 20
1.4 Assignment Statements......Page 24
1.5 Output......Page 27
1.6 Input......Page 34
1.7 Arithmetic Statements......Page 36
1.8 Comments......Page 43
1.9 Program Design......Page 44
1.10 Complete Program: Implementing a Simple Program......Page 47
1.12 Exercises (Items Marked with an * Have Solutions in Appendix E)......Page 50
2.1 Introduction......Page 53
2.2 Classes and Objects......Page 54
2.3 Public and Private Data Members......Page 55
2.5 Void Methods and Parameters......Page 56
2.6 Creating Objects and Invoking Methods......Page 58
2.7 Contour Diagrams......Page 59
2.8 Constructors......Page 64
2.9 Multiple Objects and Classes......Page 67
2.10 Universal Modeling Language (UML) Class Diagrams......Page 74
2.11 Complete Program: Implementing a Simple Class and Client Program......Page 76
2.12 Summary......Page 77
2.13 Exercises (Items Marked with an * Have Solutions in Appendix E)......Page 79
3.2 If-Then Structure......Page 82
3.3 If-Then-Else Structure......Page 88
3.4.1 If-Then-Else-If Structure......Page 91
3.4.2 If-Then-If Structure......Page 93
3.4.3 Dangling Else Problem......Page 95
3.5 Logical Operators......Page 99
3.6 Case Structure......Page 106
3.7.1 Simple Program......Page 111
3.7.2 Program with Objects......Page 114
3.9 Exercises (Items Marked with an * Have Solutions in Appendix E)......Page 116
4.1 Introduction......Page 120
4.2 Pretest Indefinite Loop Structure......Page 121
4.2.1 Count-Controlled Indefinite Iteration Structure......Page 122
4.2.2 Sentinel Controlled Loop......Page 129
4.3 Posttest Indefinite Loop Structure......Page 133
4.4 Definite Iteration Loop Structure......Page 137
4.5 Nested Iteration Structures......Page 140
4.6 Potential Problems......Page 142
4.7 Complete Programs: Implementing Iteration Structures......Page 143
4.7.1 Simple Program......Page 144
4.7.2 Program with Objects......Page 146
4.9 Exercises (Items Marked with an * Have Solutions in Appendix E)......Page 151
5.1 Sending an Object to a Method......Page 155
5.2 Returning an Object from a Method......Page 158
5.3 Overloaded Constructors and Methods......Page 160
5.4 Use of the Reserved Word this......Page 165
5.5.1 Local, Instance, and Class Constants......Page 169
5.5.2 Local, Instance, and Class Variables......Page 174
5.5.3 Class Methods......Page 177
5.6.1 Program Focusing on Overloaded Methods......Page 179
5.6.2 Program Focusing on Class Data Members and Class Methods......Page 187
5.8 Exercises (Items Marked with an * Have Solutions in Appendix E)......Page 191
6.2 String Class......Page 197
6.3 String Concatenation......Page 198
6.4.2 The indexOf Method......Page 200
6.4.3 The substring Method......Page 201
6.4.4 Comparison of Two String Objects......Page 203
6.4.5 The equalsIgnoreCase Method......Page 206
6.4.6 The charAt Method......Page 207
6.5 The toString Method......Page 208
6.6 Complete Program: Implementing String Objects......Page 210
6.7 Summary......Page 212
6.8 Exercises (Items Marked with an * Have Solutions in Appendix E)......Page 213
7.2 Array Declaration......Page 215
7.3 Array Access......Page 217
7.4 Input, Output, Simple Processing, and Methods......Page 218
7.4.1 Input......Page 219
7.4.2 Output......Page 222
7.4.3 Simple Processing......Page 223
7.4.4 Passing an Array to and from a Method......Page 224
7.5 Reversing an Array......Page 225
7.6.1 Sequential Search......Page 230
7.6.2 Binary Search......Page 231
7.7 Sorting an Array......Page 233
7.7.1 Simplified Bubble Sort......Page 234
7.7.2 Modified Bubble Sort......Page 236
7.8 Two-Dimensional Arrays......Page 237
7.8.1 Declaration, Creation, and Initialization......Page 238
7.8.2 Input and Output......Page 240
7.8.3 Processing Data......Page 241
7.8.4 Passing a Two-Dimensional Array to and from a Method......Page 244
7.8.5 Asymmetrical Two-Dimensional Arrays......Page 246
7.9 Arrays of Objects......Page 248
7.10 Complete Program: Implementing an Array......Page 250
7.12 Exercises (Items Marked with an * Have Solutions in Appendix E)......Page 254
8.2 The Power Function......Page 256
8.3 Stack Frames......Page 264
8.4 Fibonacci Numbers......Page 265
8.5 Complete Program: Implementing Recursion......Page 275
8.7 Exercises (Items Marked with an * Have Solutions in Appendix E)......Page 277
9.1 Inheritance......Page 278
9.2 Protected Variables and Methods......Page 287
9.3 Abstract Classes......Page 288
9.4 Polymorphism......Page 289
9.5 Complete Program: Implementing Inheritance and Polymorphism......Page 295
9.6 Summary......Page 299
9.7 Exercises (Items Marked with an * Have Solutions in Appendix E)......Page 300
10.2 File Input......Page 303
10.3 File Output......Page 308
10.4 File Input and Output Using an Array......Page 310
10.5 Specifying the File Location......Page 313
10.6.1 Matrix Multiplication......Page 315
10.6.2 Sorting Data in a File......Page 317
10.8 Exercises (Items Marked with an * Have Solutions in Appendix E)......Page 319
A.1 Message Dialog Boxes......Page 321
A.2 Input Dialog Boxes......Page 322
A.3 Converting String Input from Input Dialog Boxes to Numbers......Page 324
A.4 Confirmation Dialog Boxes......Page 326
A.5 Option Dialog Boxes......Page 327
B.1 Exception Class and Error Class......Page 330
B.2 Handling an Exception......Page 331
B.3 Throwing Exceptions and Multiple catch Blocks......Page 334
B.4 Checked and Unchecked Exceptions......Page 339
C.1 Javadoc......Page 343
C.2 More Javadoc Tags......Page 346
C.3 Generating Javadoc Documentation from a Command Line......Page 347
Appendix D: Glossary......Page 349
Chapter 2......Page 352
Chapter 3......Page 353
Chapter 4......Page 354
Chapter 5......Page 355
Chapter 7......Page 356
Chapter 9......Page 357
Chapter 10......Page 358
Useful Websites......Page 359
Index......Page 360

Guide to Java: a concise introduction to programming
 9781447163169, 9781447163176, 1447163168, 1447163176

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Recommend Papers