views:

258

answers:

7

I'm an experienced C / C++ programmer who now has to learn Java. Is reading The Java Language Specification a useful and efficient way to get up to speed or is there some better resource, say something similar to the wonderful Accelerated C++ by Koenig? Currently I'm reading Java Software Solutions and am finding it quite slow and mind numbing.

+3  A: 

Coming from the C++ side, I learnt Java by using three things:

JUST MY correct OPINION
Isn't Apache written in C?
Robert S. Barnes
The Apache server is the smallest portion of the Apache Project these days. Tomcat is written in Java, for example. As is Geronimo. As is ... well, about 90% of the Apache Project's source. Go check out the provided link.
JUST MY correct OPINION
+3  A: 

I'd say you can learn Java as language from the JLS in the same way you can learn mathematics by reading books; it won't do you any good until you actually sit down and start applying the theoretical skills you have accumulated.

In general, I think best way to learn languages is to learn their idioms and work from there. For example, language can be object oriented, procedural, functional or any combination of these, may be built on automatic or manual resource handling, uses actual syntax to denote importance of certain elements (for example several languages nowadays equal \n to ; and others use whitespace as block identifiers).

Esko
+8  A: 

I would recommend Head First Java first. Then, Effective java. Generics FAQ of Java, which is available as downloadable PDF too.

JavaGeek
Java language specification is always there. :)
JavaGeek
+1 I suggest my students the same :-).
Helper Method
May I get an explanation about the down vote?
JavaGeek
Please read this FAQ before down voting. Thanks!http://stackoverflow.com/privileges/vote-down
JavaGeek
But i would suggest that Head First Java is not needed, since hi\e is already an experienced C++ programmer....The book (HF Java) itself says that it is not meant for those who are experienced C++ programmers....:-)
Shahensha
I picked up one of the Head First books once ( don't remember which one ) and I simply hated the style. Too wordy and drawn out. I much prefer the straight to the point style of writers like Koenig or Myers or Alexandrescu ( don't know if I spelled that last one correctly ).
Robert S. Barnes
Well, it was your opnion. I liked the book. And this I got it from FAQ which I really feel to be mentioned here, "Whenever you encounter an egregiously sloppy, no-effort-expended post, or an answer that is clearly and perhaps dangerously incorrect, vote it down!"So, whether my answer was useless, or so dangerous to vote it down??
JavaGeek
I'm an old geezer for the programming trade, so I tend to agree with Robert S. Barnes' opinion of the *Head First* line. I can see where they've got their place, but I don't think their place is for experienced developers learning a mild variant of what they already know. It's been too many years since I've been a beginner, so I really can't read them through beginners' eyes any more, but through the old fogey's eyes they read like content-free hand-holding. (Didn't vote -1, mind. Opinion is not a reason to vote down.)
JUST MY correct OPINION
JavaGeek, don't sweat the small stuff on the -1 vote. There are serial downvoters out there who'll vote -1 because they don't like your handle or because you said something they didn't like in a comment to another question so they downvote one of your answers in a form of petty revenge. Just ignore the -1 votes if your balance is positive. Letting it get under your skin is just what these people want (or they'd have actually explained the down vote in comments).
JUST MY correct OPINION
@JUST_MY_correct_OPINION: Agreed. :)
JavaGeek
+2  A: 

C++ syntax is pretty close to Java. The semantics are, however, somewhat different especially in terms of the object hierarchy tree.

If you are an experienced C++ coder, I would consider having a look at one of the many "Java for C/C++ programmers" cheat sheets to get the important points and then work my way through the Learning Java part of the Java Tutorial. You need to get it in through the fingers, and the exercises for the Java Tutorial are okay for this purpose.

Then you have your drivers license, and can dive into learning the Java Runtime Library because it is just huge and it will take some time to learn.

Thorbjørn Ravn Andersen
+3  A: 

Reading the language specification is not an efficient way to get started learning the language. It is a document written for a very different purpose. It is well suited to getting the details and nuances right. Java is a less complex language than c++, and I found the need to refer to the specification comes up less often.

From a practical point of view, what kind of java do you need to learn? Do you need to fit into an existing project using lots of old style java, do you need to get up to date with the latests enterprise frameworks and tools, do you need to do some JSR work?

Stephan Eggermont
+2  A: 

One of the key features of current-day Java is the huge, active open source community and the many tools/libraries/frameworks available for anytyhing you'd ever need to do. Learning just the Java language (which you might be able to do as you describe) is usually not enough to be productive in any serious Java project. Besides learning the language, take a look at the frameworks you are likely to need. In a typical J2EE environment you might encouter:

  • Build management: Maven, Ant
  • Dependency injection: Spring, Guice
  • Persistence: Hibernate, iBatis, JPA, JTA
  • Application container: Websphere/Weblogic/Glassfish/Tomcat/Jetty
  • Logging: Log4j, Commons logging, SLF
  • Web framework: Struts 2, Tapestry, Spring Web MVC, JSF, GWT, Wicket

There is a lot more where that came from... Check which stuff you are likely to need and start with that.

Adriaan Koster
+2  A: 

Why not give The Art and Science Of Java a try? It scores in its content.

Humming Bird
I say it again here, HF Java is not required for you...Also you can skip the initial sextions of the Art and SCience of Java...
Shahensha