Programmers, computer scientists, and engineers need a book that delivers the essentials of how to program using Java in a more accessible, less rigorous approach. Java for Everyone provides them with a more user-friendly, graphics-intensive design that conveys complex concepts simply and effectively. It differs from other books in the market by focusing on topics such as loops and graphical interfaces, while avoiding a focus on object-orientation. The emphasis is placed on simple programs that use pre-built data structures and algorithms whenever possible. The examples and case studies explore practical applications that programmers, computer scientists, and engineers will find useful, such as processing tabular data, harvesting Web information, creating custom graphics, and building simple user interfaces.
Table of Contents
PREFACE . SPECIAL FEATURES. CHAPTER 1 INTRODUCTION. 1.1 Computer Programs . 1.2 The Anatomy of a Computer . 1.3 The Java Programming Language . 1.4 Becoming Familiar with Your Programming Environment . 1.5 Analyzing Your First Program . 1.6 Errors . 1.7 Algorithms. CHAPTER 2 FUNDAMENTAL DATA TYPES. 2.1 Declaring Variables . 2.2 Variable Assignment . 2.3 Reading Input . 2.4 Constants . 2.5 Arithmetic . 2.6 Strings. CHAPTER 3 DECISIONS. 3.1 The if Statement . 3.2 Comparing Numbers and Strings . 3.3 Multiple Alternatives . 3.4 Nested Branches . 3.5 Boolean Variables and Operators . 3.6 Application: Input Validation. CHAPTER 4 LOOPS. 4.1 The while Loop . 4.2 The for Loop . 4.3 The do Loop . 4.4 Application: Processing Sentinel Values . 4.5 Common Loop Algorithms . 4.6 Nested Loops . 4.7 Application: Random Numbers and Simulations . CHAPTER 5 METHODS. 5.1 Methods as Black Boxes . 5.2 Implementing Methods . 5.3 Parameter Passing . 5.4 Return Values . 5.5 Methods Without Return Values . 5.6 Stepwise Refinement . 5.7 Variable Scope . 5.8 Recursive Methods (Optional) . CHAPTER 6 ARRAYS AND ARRAY LISTS. 6.1 Arrays . 6.2 The Enhanced for Loop . 6.3 Common Array Algorithms . 6.4 Using Arrays with Methods . 6.5 Two-Dimensional Arrays . 6.6 Array Lists . CHAPTER 7 OBJECTS AND CLASSES. 7.1 Object-Oriented Programming . 7.2 Specifying the Public Interface of a Class . 7.3 Instance Variables . 7.4 Instance Methods . 7.5 Constructors . 7.6 Testing a Class . 7.7 Discovering Classes . 7.8 Object References . 7.9 Static Variables and Methods . 7.10 Packages . CHAPTER 8 INPUT/OUTPUT AND EXCEPTION HANDLING. 8.1 Reading and Writing Text Files . 8.2 Processing Text Input . 8.3 Command Line Arguments . 8.4 Exception Handling . 8.5 Application: Handling Input Errors . CHAPTER 9 INHERITANCE AND INTERFACES. 9.1 Inheritance Hierarchies . 9.2 Implementing Subclasses . 9.3 Overriding Methods . 9.4 Polymorphism . 9.5 Object: The Cosmic Superclass . 9.6 Interface Types . CHAPTER 10 COLLECTIONS AND MAPS. 10.1 The Java Collections Framework . 10.2 Linked Lists . 10.3 Queues and Stacks . 10.4 Sets . 10.5 Maps . 10.6 Hash Tables . 10.7 Binary Search Trees . CHAPTER 11 GRAPHICS AND EVENT HANDLING (WEB ONLY). 11.1 Frame Windows. 11.2 Drawing on a Component. 11.3 Ellipses, Lines, Text, and Color. 11.4 Shape Classes. 11.5 Events and Event Handling. 11.6 Using Inner Classes for Listeners. 11.7 Building Applications with Buttons. 11.8 Using Timer Events for Animations. 11.9 Mouse Events. 11.10 Using Inheritance to Customize Frames. CHAPTER 12 GRAPHICAL USER INTERFACES (WEB ONLY). 12.1 Processing Text Input. 12.2 Text Areas. 12.3 Layout Management. 12.4 Choices. 12.5 Menus. 12.6 Exploring the Swing Documentation. CHAPTER 13 RECURSION (WEB ONLY). 13.1 Triangle Numbers. 13.2 Recursive Helper Methods. 13.3 The Efficiency of Recursion. 13.4 Permutations. 13.5 Mutual Recursions. APPENDICES. APPENDIX A THE BASIC LATIN AND LATIN-1 SUBSETS OF UNICODE . APPENDIX B JAVA OPERATOR SUMMARY . APPENDIX C JAVA RESERVED WORD SUMMARY . APPENDIX D THE JAVA LIBRARY . APPENDIX E JAVA SYNTAX SUMMARY. APPENDIX F HTML SUMMARY. APPENDIX G TOOL SUMMARY. APPENDIX H JAVADOC SUMMARY. APPENDIX I NUMBER SYSTEMS. APPENDIX J BIT AND SHIFT OPERATIONS. APPENDIX K UML SUMMARY. APPENDIX L JAVA LANGUAGE CODING GUIDELINES. GLOSSARY . INDEX . ILLUSTRATION CREDITS. ALPHABETICAL LIST OF SYNTAX BOXES. Arrays. Array Lists. Assignment. Catching Exceptions. Comparison. Constructors. Constructor with Superclass Initializer. for Statement. if Statement. Input Statement. Instance Methods. Instance Variables. Interface Types. Java Program. Method Declaration. Subclass Declaration. The "for each" Loop. The finally Clause. The instance of and Cast Operators. The throws Clause. Throwing an Exception. Two-Dimensional Array Declaration. while Statement. Variable Declaration .
Cay S. Horstmann is a Professor of Computer Science in the Department of Computer Science at San Jose State University. He is an experience professional programmer and was Vice President and Chief Technology Officer for Preview Systems, Inc. He is also a consultant for major corporations, universities, and organizations on Java, C++, Windows, and Internet programming. Horstmann is the author of many successful professional and academic books, including Big C++, C++ For Everyone, Big Java, Java Concepts, Object Oriented Design and Patterns (all John Wiley & Son, Inc.), and Core Java (Sun Microsystems Press), with Gary Cornell.