Think In JAVA (the third edition) [6]
Provide you with a solid foundation so that you can understand the issues well enough to move on to more difficult coursework and books.
JDK HTML documentation
The Java language and libraries from Sun Microsystems (a free download from java.sun.com) come with documentation in electronic form, readable using a Web browser, and virtually every third-party implementation of Java has this or an equivalent documentation system. Almost all the books published on Java have duplicated this documentation. So you either already have it or you can download it, and unless necessary, this book will not repeat that documentation, because it’s usually much faster if you find the class descriptions with your Web browser than if you look them up in a book (and the on-line documentation is probably more up-to-date). You’ll simply be referred to “the JDK documentation.” This book will provide extra descriptions of the classes only when it’s necessary to supplement that documentation so you can understand a particular example.
Chapters
This book was designed with one thing in mind: the way people learn the Java language. Seminar audience feedback helped me understand the difficult parts that needed illumination. In the areas where I got ambitious and included too many features all at once, I came to know—through the process of presenting the material—that if you include a lot of new features, you need to explain them all, and this easily compounds the student’s confusion. As a result, I’ve taken a great deal of trouble to introduce the features as few at a time as possible.
The goal, then, is for each chapter to teach a single feature, or a small group of associated features, without relying on features that haven’t been introduced yet. That way you can digest each piece in the context of your current knowledge before moving on.
Here is a brief description of the chapters contained in the book, that correspond to lectures and exercise periods in the Thinking in Java seminar.
Chapter 1: Introduction to Objects
(Corresponding lecture on the CD ROM). This chapter is an overview of what object-oriented programming is all about, including the answer to the basic question “What is an object?” It looks at interface versus implementation, abstraction and encapsulation, messages and methods, inheritance and composition, and the subtle concept of polymorphism. You’ll also get an overview of issues of object creation such as constructors, where the objects live, where to put them once they’re created, and the magical garbage collector that cleans up the objects that are no longer needed. Other issues will be introduced, including error handling with exceptions, multithreading for responsive user interfaces, and networking and the Internet. You’ll learn what makes Java special and why it’s been so successful.
Chapter 2: Everything is an Object
(Corresponding lecture on the CD ROM). This chapter moves you to the point where you can write your first Java program. It begins with an overview of the essentials: the concept of a reference to an object; how to create an object; an introduction to primitive types and arrays; scoping and the way objects are destroyed by the garbage collector; how everything in Java is a new data type (class); the basics of creating your own classes; methods, arguments, and return values; name visibility and using components from other libraries; the static keyword; and comments and embedded documentation.
Chapter 3: Controlling Program Flow
(Corresponding set of lectures on the CD ROM: Thinking in C). This chapter begins with all of the operators that come to Java from C and C++. In addition, you’ll discover common operator pitfalls, casting, promotion, and precedence. This is followed by the basic control-flow and selection operations that you get with virtually any programming language: choice with