Java 1.2 and Javascript for C and C++ Programmers
![Medium Thumbnail](http://images.amazon.com/images/P/0471183598.01.MZZZZZZZ.jpg)
Book Details
Availability: This item is currently not available.List Price: $54.99
Our Price:
You Save: $54.99 (0%)
![Buy through Amazon.com](/images/buyamazon.gif)
Spotlight Customer Reviews
Average Customer Rating: 3.17Customer Rating: 2
Summary: Badly written book - avoid it!
Comment: The book was published in January 1998 so it only reflects pre-beta changes. Unfortunately, this can be spotted in both the quality of the text and its reflecting advanced Java 2 things (no mention of Collections etc). It wouldn't alone make a book bad - after all, you should buy for example Thinking in Java that has a wonderful chapter on Collections -, but the 1.0 / 1.1-specific stuff is also badly explained. Very important C/C++-related subjects are not mentioned: the inherent differences between C/C++'s and Java's static is not even mentioned. Comparing the C++ and Java exception libraries is also painfully missing from the book. And there are a lot of C++ listings in the book without much help - the authors seem to forget sometimes that they're working on a book on Java and not on C++.
Core Java has no C++ in its title, but I still found it at least as useful as this book when it comes to emphasizing the differences and similarities between the two languages. Having lost its greatest advantage over Core Java, the book has nothing to offer for the seasoned programmer. It's weak as a reference, it's even weaker at actually teaching Java in a comprehensible way. C programmers should not try to learn the Java from this book - especially not OOP. The book's sections targeted at C programmers don't actually teach how an OOP structure can be translated into plain C. C++ programmers may find the book relatively easy to understand. Books like Thinking in Java or Core Java are still far more comprehensible - I don't really think you should present your beginner readers complete applications that utilize streams right at the beginning. Let's agree to differ - some readers may find it cool to get complete, non-toy (?) applications - I didn't. Some chapters only have one or two big examples (there are - later - chapters that don't have any!) - a lot of small code snippets teach the language far more efficiently than a big one, no matter how complicated and advanced it is.
The comparisons to C and C++ in the first five chapters are overwhelming (still, as was already mentioned, some key differences haven't been mentioned); later chapters don't compare Java to C(++) any more - they may have been written by different authors.
The book doesn't explain name conventions. Doesn't use them either. Most classnames begin with lowercase letters - very annoying! Another common mistake is importing the classes used in the same package - especially in the first chapter. As with most Wiley titles, there is no code highlighting in the book, and the editing is, in general, quite sloppy (quite a few typos, duplicated words etc).
Chapter 1: Introduction to Java: compares almost everything to C/C++. The rest of the chapter describes how JDK should be installed and used.
p. 16: "...which is why the main function of Source 1.7 only contains the constructor for the bookWindow()"; "once we have added all the components, we can... size the window using either width or height or the pack() methods". The book being written in late 1997, it still refers to classes.zip and CLASSPATH.
Chapter 2: Comparing Java to ANSI C: explains packages, import (also emphasizes the difference between import and #include). Compares keywords, literals, expressions, identifiers etc. between the two languages (allowed characters, length etc, but no name conventions). Compares arrays (also mentions reference arrays and their dangerous behavior) and strings. Even uses PixelGrabber in the examples - very hard to follow for a beginner. Quite interesting examples (Base16 coders etc). A section about the features removed from C: keywords, global variables, pointers, preprocessor directives, variable arguments (recommends using Vectors instead). The chapter is packed with C examples - sometimes you can feel it's a C tutorial. Lists the header files of the entire C standard library and shows their Java equivalents: assert -> nothing, ctype -> Character's methods, errno -> Exceptions, float, limits, locale -> i18n, math -> Math's methods; setjmp -> Exception, (p. 92: "since Java provides both exceptions and threads, there is need for setjmp and longjmp in Java" (that is, no need); signal -> Exception, stdarg -> Vector, stddef, stdio, stdlib, string, time.
The chapter doesn't try to teach any OOP-related subject.
Chapter 3: Comparing Java to C++: teaches some OOP (why not in the previous chapter, for the C programmers, who really need this introductory stuff?!) - the explanation is quite abstract and almost useless for a newbie to OOP (lacks almost everything that makes a good OOP text great). The book uses 'class methods' when referring to instance methods and static class methods when referring to static methods - very annoying for people that are used to the right terminology. Mentioned the difference between C++ and Java when it comes to initializing static class members.
The explicit super() explanation is OK, but the book never mentions the difference between Java and C++ in the usage of this() in the constructor (shows it in Java but doesn't mention it doesn't exist in C++).
Compares Java's clone() to C++'s copy constructor - just so as a decent Java book should introduce the subject. I find Core Java's or Thinking in Java's discussion much better, though. And most beginner C++ books do much better work at explaining why explicit copy constructors are needed.
Shows the syntactic difference between C++ and Java inheritance (while making a mistake in the table: a superfluous colon). Also shows abstract (pure virtual) methods: source 3.13, which comes right after this, has the main class drawShapes (yes, wrong capitalization) using AWT and the drawing methods of Graphics. As a lot of C++ books are showing examples of just this Shape <- Square / Triangle / Hexagon relationship with an abstract calculatePoints() in the superclass to make readers understand how overriding and dynamic method dispatch works, I expected this book the same: an example that has an array of type Shape containing elements of the above-mentioned subclasses, getting these elements out the array and calling calculatePoints() on them to see whether dynamic dispatch really works. Unfortunately, the authors have missed this chance to really show the readers how runtime binding works - you have to choose from the menu which shape to draw and voila - it gets drawn. No reference arrays of type superclass, nothing. The very next example does just this with a much less interesting example (actually, it's just another toy example).
Touches on exceptions, shows the difference between C++'s catchall - that is, catch (...) - and Java's catch (Exception). The C++ example here is again a very bulky one, it is only included here to show that in C++ you don't have to declare what kind of exceptions will be thrown out of any methods. Doesn't draw a line between unchecked and checked exceptions - it only happens later. Some severe errors are made:
"classes derived from the Exception class fall into the category of errors that can be recovered from, whereas classes derived from the RuntimeException generally cannot be recovered from" - this is not the only point where the readers show they confuse the subclasses of Error for the children of RuntimeException. It is a very severe error.
The chapter also discusses inner classes - quite brightly. I still miss the explanation of static member classes - the authors only devoted one sentence to them.
Also presents the C++ Standard Library (the comparison takes some 3 pages).
Chapter 4: Language features not in C or C++: discusses packages, interfaces (doesn't show how they can be used as types / for callback), dynamic type inquiries (Class.forName() etc. - this sub-chapter should have been put in Chapter 6 entirely) and threads.
This sub-chapter is quite weak: there is no wait/notify (not in the entire book, actually); doesn't try to explain what the difference between implementing Runnable and extending Thread is; doesn't try to explain why some methods got deprecated and has errors like the following: p.195: "the Runnable interface is simply implementing the run method".
Chapter 5: JNI; 17 pages;
Chapter 6: The Java Language Classes and Reflection: there is a severe error in the title, as it refers to java.lang and definitely not all classes of the language. Discusses wrapper classes (doesn't mention they're immutable; doesn't show which of them were introduced only in 1.1; and suggests only Integer and Long have parse
Customer Rating: 5
Summary: Its realy good book.
Comment: This is really good book for people who already have been programming in C/C++ and want to switch to Java. It covers the differences between java and C/C++ in a very succinct manner and helped really get good command on Java.
Customer Rating: 2
Summary: Useful Java material, but...
Comment: I found the Java material quite useful and informative, however, I bought this book in March of 1998, when JDK 1.2 was not even released!!! So this mystery vexes me a lot! It seems the authors are trying to jump on the publication frenzy and bandwagon. The Java stuff in there is good, I just question the accuracy of it all.