Welcome to javaranch Liu. I highly recommend you head first java, by Bert Bates and Kathy Sierra, it's an excellent book. If you want to target certification (SCJP), then this is the way to go. The authors (and us ) are always around here so if you happen to have any questions, erratas, etc., you can post it in the appropriate forum and you'll get an answer pretty quick. good luck [ August 21, 2003: Message edited by: Andres Gonzalez ]
I'm not going to be a Rock Star. I'm going to be a LEGEND! --Freddie Mercury
Hi Liu. People learn in different ways and like different books. There seem to be many people who really like Thinking in Java. I knew C but not C++ before learning Java. I studied the two volumes of Core Java by Cay Horstmann. Then I read The Java Programming Language by Arnold, Gosling, Holmes. Then I read Java Network Programming, by Elliotte Rusty Harold. I would suggest browsing Thinking in Java and Core Java to decide which style helps you the most. Both books are used by my local university for teaching Java to C programmers. Everyone should read The Java Programming Language, but not as the first Java book.
Besides Core Java volumes I & II, Cay Horstmann also has two other really good Java books - Big Java (for beginning Java programmers) and OO Design and Patterns [using Java] (for people who know a just a little Java).
I was a C systems level programmer for many years. In 1997, I took a C++ class at Boston University. The class was an eye opener because of the way it was taught: Not to flood you with tool usage and skills to get you immediately productive, but rather, how to understand how the FEATURES of the language allow you to write more maintainable, more extensible code. I think many Java books try to provide too must instant gratification ; you get bombarded with examples of how to use this API and that API to do all these cool practical things. Java is all about helping you write correct code that is maintainable and extensible. Keep this in mind as you learn the facets of the language. The features of the language are all responses to problems that folks observed during the last 30 years of software development. The "rules" of programming in Java are designed to HELP you avoid pitfalls in implementation and design that might lead to unmaintainable, unextensible code. Java does this because the compiler enforces TONS of rules on your source code. In the past, you might have learned about how to write code that is fast. You might have also spent MORE time learning APIs and extracting value from them then spending time on thinking about good software design. Time to put an end to learning and thinking that way... When you learn Java, keep in mind that all the arcane rules about things (i.e. overriding constructors, subclassed exceptions, threads model), are designed intentionally to FORCE you to write code that has a shot of (1) working and (2) being extensible out of the box. Java cant do everything, much is still in the hands of the developer. When you learn Java, you must always think about How Can I Use the Features of the Core Language to write high-quality code. Worrying about solving particular problems is a hackers mentality. Problem solving is assumed, elegance and refinement is the objective here. -- Jim