This book presents a focused and accessible primer on the fundamentals of Java programming, with extensive use of examples and hands-on exercises. Topics and features: provides an introduction to variables, input/output and arithmetic operations describes objects and contour diagrams, explains selec
Guide to Java: a concise introduction to programming
โ Scribed by Streib, James T;Soma, Takako
- Publisher
- Springer
- Year
- 2014
- Tongue
- English
- Leaves
- 363
- Series
- Undergraduate topics in computer science
- Category
- Library
No coin nor oath required. For personal study only.
โฆ Synopsis
Seeking to learn quickly how to program in Java without prior experience? ThisGuide to Javapresents a focused and accessible primer on the fundamentals of Java programming, with extensive use of illustrative examples and hands-on exercises.
Addressing the need to acquire a good working model of objects in order to avoid possible misconceptions, the text introduces the core concepts of object-oriented programming at an early stage, supported by the use of contour diagrams. Each chapter has one or more complete programs to illustrate the various ideas presented, and to help readers learn how to write programs on their own. Chapter summaries and practical exercises are also included to help the reader to review their progress and practice their skills.
Topics and features: provides an introduction to variables, input/output, and arithmetic operations; describes objects and contour diagrams, explains selection structures, and demonstrates how iteration structures work; discusses object-oriented concepts such as overloading and classes methods, and introduces string variables and processing; illustrates arrays and array processing, and examines recursion; explores inheritance and polymorphism, and investigates elementary files; presents a primer on graphical input/output, discusses elementary exception processing, and presents the basics of Javadoc; includes exercises at the end of each chapter, with selected answers in an appendix, and a glossary of key terms; provides additional supplementary information at an associated website.
This concise and easy-to-follow textbook/guide is ideal for students in an introductory programming course. It is also suitable as a self-study guide for both practitioners and academics.
โฆ 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
๐ SIMILAR VOLUMES
<p><span>This textbook presents a focused and accessible primer on the fundamentals of Java programming, with extensive use of illustrative examples and hands-on exercises.</span></p><p><span>Addressing the need to acquire a good working model of objects in order to avoid possible misconceptions, th
A Concise and Practical Introduction to Programming Algorithms in Java has two main goals. The first is for novice programmers to learn progressively the basic concepts underlying most imperative programming languages using Java. The second goal is to introduce new programmers to the very basic prin
<p><P>This gentle introduction to programming and algorithms has been designed as a first course for undergraduates, and requires no prior knowledge. </P><P></P><P>Divided into two parts the first covers programming basic tasks using Java. The fundamental notions of variables, expressions, assignmen