Author: Rogers Cadenhead
Publisher: Sams, 2010
Aimed at: Complete beginners
Pros: A reasonable introduction for those prepared to work at it
Cons: Desire to be comprehensive presents difficulties
Reviewed by: Alex Armstrong
Java in 24 hours - well only if those 24 hours are spread out over a few weeks and augmented by plenty of practical experience but would it work even then?
The subtitle of this edition of the well-known introduction to Java is "Covering Java 7 and Android". The Java 7 part is easy to believe, because when you are just beginning there isn't a lot of difference between Java 6 and 7. However, it is always nice to learn the latest version and there is no disadvantage in covering Java 7. The Android claim, however, sounds more like an attempt to stay relevant. You can't really teach Android as part of a bigger and more general look at Java - the most you can hope to do is an overview or a taster.
The first problem, and it is a problem for any book introducing any language, is what IDE to use? In fact with Java you could opt not to use any IDE at all apart from a text editor. In fact this book uses NetBeans, but it doesn't really want to be that up-front about it. You are told how to install and get started with NetBean in an appendix at the end. This is a shame because personally I think NetBeans is a great way to learn Java. It is easy to use and, as important, it has a drag-and-drop interface designer which makes it suitable for the complete beginner.
The book starts very gently - perhaps even too gently. Chapter 1, or Hour 1 in the book's terminology, opens with a look at Java and IDEs and it is here you have to notice that installing NetBeans is a good idea. Chapter 2 works you up to your first program, a hello world. This might be considered boring but it really is the best way to get started. The example goes a little further than it needs to in that it introduces the class file and the idea of variables, all of which is gone over again later in the book.
After making a flying start we take a break in Chapter 3 with an examination of the wider Java ecosystem - you could skip this or leave it for later. Chapter 4 more or less starts over with another first program, only this time it is a lot more technical. In this case we pass arguments to the program and turn it into an applet.
Then Chapters 5 and 6 introduce enough basic data types and expressions to get us started. Chapters 7 and 8 moves into the consideration of the flow of control - if statements followed by loops. The tendency is to cover just about everything that is related, so as well as if statements we have the switch and the conditional operator. For the beginner it would be better to postpone the more advanced and less used facilities to a later chapter that went over the whole flow of control idea. Of course, after loops you have to deal with arrays and, again, Chapter 9 might be too complete a coverage of the basic idea of the complete beginner.
Chapter 10 is where we move from the purely algorithmic into the object-oriented world with "Creating your First Object". This isn't a bad way of introducing object but it does tend to go into irrelevant detail and over-generalizations. At the end of the chapter you have created your first object, used it to create another via inheritance and created an instance or two. Perhaps this is too fast for many readers. The next two chapters are about building on object ideas. Chapter 11 is about properties, methods and constructors but, along the way, it also goes into inner classes and it's difficult to see why. Chapter 12 is about using supplied classes and using inheritance to build your own derived classes.
Chapter 13 moves on to using the Swing and AWT class libraries - which would have been a really good introduction to objects and classes if presented earlier. Chapters 14,15 and 16 form a basic introduction to working with user interfaces and at this point you are more or less assumed to be a Java programmer and what is being explained is the way you use the class libraries to build interfaces.
From this point on the book really deals with ad-hoc topics. Chapter 17 is about web applications, 18 is about error handling, 19 is about threading, 20 is about files, 21 is on XML, 22 on Web Services with JAX-WS, 23 on Java2D graphics and 24 is on creating Android Apps. As predicted the chapter on Android is no more than a getting started, taking you as far as a "hello world". Given how fast Android is moving don't expect the steps described to correspond to reality. If you buy the book for Android training you won't get very far but a taster might be enough for you to see that you can create Android apps.
The overall style of the book is very light but you might find that the author's slightly bizarre sense of humour wears thin by the time you reach the end. While the descriptions and introductions are quite good, the main problem is the tendency to include nearly everything the first time a topic is introduced. As a result the book works best for the beginner who has seen some programming ideas before. If you are a complete beginner then my advice is to concentrate on the first part of each chapter and revisit the material when you have had practice and time for it so sink in.
The final verdict has to be that this is a quite a good attempt at an introduction to Java, it could be better and it isn't ideal for the complete beginner but if you are prepared to work at it then you probably can use it to learn to program in Java.