tags:

views:

495

answers:

12

I've installed Eclipse and the JDK, gone through the "Hello World" tutorial, and read through the Eclipse docs (both about Eclipse itself and developing Java with Eclipse). I'm looking at the JUnit samples to better understand how Java works when it runs.

I'm at that point of confusion one gets when learning a new computer language that has newer paradigms, and I think it's partially due to my experience with C++.

Any suggestions on good Java books/tutorials/etc. for someone with a C/C++ background?

+1  A: 

Head First Java seems to be popular among the people I work with who come from a C++ background. If you like mathematics, solving problems on Project Euler can also be a lot of fun, doing that with Python now.

Stefan Thyberg
+1  A: 

Java's pretty big. I don't know what kind of problems you've been solving with C++, but I'd suggest that you partition Java along these lines:

Java SE is the core language. It includes the Swing UI classes and JDBC, so it'd be good for writing desktop apps if that's what you've been using C++ for.

Java EE is built on top of Java SE. It has lots of "enterprise" features, including Java Server Pages, EJBs, messaging, etc., for building distributed, transactional, multi-user applications.

If you want to write desktop apps, I'd suggest concentrating on Swing and JDBC. All you'll need is JDK 6 and maybe the relational database of your choice.

If you want to write web apps, I'd suggest JSPs written using JSTL and JDBC with a servlet/JSP engine like Tomcat.

You can go a long way with just those technologies. As you become more comfortable, expand your circle.

duffymo
+1  A: 

I've always found Sun's Java Tutorial to be extraordinarily helpful. You can look up language basics as needed (or breeze through easy sections quickly), but you can easily dive into more advanced topics (GUIs with Swing, concurrency, containers, etc.).

zweiterlinde
+1  A: 

Best way to learn it is just to do it. Especially if you can pair-program with a strong Java developer. That's what I did and now I'm much better in Java and find it hard to go back to C++

OTisler
A: 

Once you've got used to Java, I suggest carefully reading through the JLS. It's a dull as ditch water, but may help point out where Java does things differently although despite it having a similar syntax.

Tom Hawtin - tackline
+1  A: 

Yes, the libraries are huge, but rather than diving into the swing api, for sheer language familiarity you might be better off writing small pieces that use the collections (the java.util package). I find that this stuff is very central to the day-to-day coding, and it will familiarize you with both generics and the way objects are created, both of which are very different from C++.

I always found Thinking in Java to be a great text, very detailed and well written.

Steve B.
+1  A: 

For getting Javaisms you should read Effective Java 2nd Edition by Joshua Bloch

For unit testing (and more) the Pragmatic Programmers books are good.

Also a good book for learning Java if you understand C/C++ look at Thinking in Java by Bruce Eckel. This book is good from some points, but falls down on others (he and I disagree on exception handling for one), but if you know C++ it is overall a good book to start with - just make sure you offset it with a couple of Java books that are not for C++ programmers :-)

For learning Java, well the core language is fairly similar to C++. Back in 1995 it took me about one day to get comfortable with Java, 3-5 days to figure out the ways it was different than C++, and about a month to learn the libraries.

Java has changed a lot since 1995 though... so one day is still prbably accurate for the first part. From a language point, depending on what you want to pick up, say a week. The library... well that could take years (at least months) depending on what you focus on.

TofuBeer
A: 

If you want to get a solid Java foundation, I would recommend getting the Java Programmer Certification from Java. It will force you to learn every fundamental aspect of the language. I did it a few years ago and I think it was worthwhile. You current employer might have programs to cover the cost of the test, which was a couple of hundred dollars, if I recall correctly.

Francois Gravel
+3  A: 
  • Start by abandoning eclipse for a while and working just with a text editor and the command line JDK tools, to get a basic understanding of how Java programs work, packages, classpaths and compiler errors.
  • Familiarize yourself with the API docs. Start with the crucial classes in java.lang, java.util, java.io and java.text
  • Sun's Java Tutorials are a pretty good starting point for deepening your understanding of specific topics
  • The Java Language Specification and the Java Virtual Machine Specification can be a great help for understanding what goes on "under the hood", which is probably comforting for a C++ guy :-). They're quite readable, as specifications go.
Michael Borgwardt
+1  A: 

Core Java includes C++ notes throughout the books to explain subtle differences between C++ and Java.

Michael Myers
A: 

I particularly agree with these suggestions:

Get Java Programmer Certification. This is a great intro to the language, not expensive, and really gives you good idea feel for the core Java language. It can definitely help on a resume, e.g. that along with the Java Developer certification helped get me my first job in Java. Check out JavaRanch for online cert help.

Read Bruce Eckel's Thinking In Java. It's free online! Great book.

Sun's Java Tutorials. very helpful.

For reference, use the online Sun Java Docs, and Java Almanac (on the web). Java Almanac is all code samples.

Jack BeNimble
A: 

Books are fun but learn by doing. Build an app.

bpapa