Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Mr.Random

macrumors newbie
Original poster
Oct 31, 2009
8
0
I would like to start with programming Java. Which book is best for beginners?

I have a basic knowledge of C # programming (nothing special).

Thanks in advance!
 
I second Deitel & Deitel, Java : how to program, 9th ed.

Another excellent book is Hortstmann, Big Java, 4th ed..

Both of these spend lots of time teaching object-orientation and algorithm development, in addition to Java syntax and Java library usage.
 
As an Amazon Associate, MacRumors earns a commission from qualifying purchases made through links in this post.
Since we are on the Java topic. I don't think I can use Xcode for Java? Is there a recommended IDE to use for my class?

-Lars
 
Since we are on the Java topic. I don't think I can use Xcode for Java? Is there a recommended IDE to use for my class?

-Lars

I'd stick to a text editor if you are just starting out. MacVim is my choice but any text editor will do (emacs, Text Wrangler, TextMate etc etc). If you absolutely must use an IDE then the choice is either Eclipse, Netbeans or IntelliJ IDEA (there is a free community version).
 
Thanks, I think I would like to compile the code to make sure it works. I don;t think I can do that within a text program. I will download one of those, thanks!
 
I have only used Eclipse as an IDE, but the cool thing about it is that I can use it with languages other than Java by installing plugins. It's strength is definitely Java development.

Of course, the non-typed languages I've used in Eclipse (Python and Perl) don't really need features like source code refactoring.
 
Thanks, I think I would like to compile the code to make sure it works. I don;t think I can do that within a text program. I will download one of those, thanks!

I use Coda and TextMate to program in Java. I think it works great and they are very customizable because you focus solely on the code, instead of all the features of the IDE (which may benefit you depending on your project). In the case of compilation, you would just compile with terminal. In terminal, use cd to get to the directory where the files are located at (you could start by putting them on the desktop) and then you compile them with Terminal.

In this case, you would type:

Code:
javac <NameOfFile>.java [ENTER]
java <NameOfFile>

"javac" starts the gcc compiler and will give you any compile-time errors. Believe me, they'll be confusing either way, through IDE or Terminal. Terminal also gives you the line code it's at just like the IDE. You can't use "java" until the program has successfully compiled.

Again, I prefer it because it's lightweight, less cruft and eventually I'll move to an IDE once I work with big projects but I'm just programming command-line interfaces and learning the UI stuff slowly.
 
The book I learned off of is JAVA: An introduction to problem solving and programming by Savitch. I love this book and highly recommend it. The others listed are also great books.

ISBN : 0-13-149202-0

With JAVA I often find that it is easier to teach folks how to start with a simple text editor and then move into an IDE. The main reason for this is that with an IDE like Netbeans or Eclipse, it can be hard to understand what is happening behind the scenes and you can also pickup some bad habits. That being said, I do know a few people that started with them and they are decent programmers now.

If you have some C# then JAVA shouldn't be to difficult to pick up.

New edition... Java book by Savitch
 
Using an IDE gives easy access to the Javadocs for the system (as well as the source code for the library if you are curious) and eliminates virtually all need for reference books. That said, a standard text editor plus the command line is basically all that is necessary to start.

I've been programming in Java for over 12 years, mostly Swing apps, and now use Netbeans, which I also use for C++ and Qt 4 programming. Its a very conventionally designed IDE. Most people I know find Eclipse bloated and confusing. What the heck is a "perspective" anyway? (I ask rhetorically.)

Recommended book: Thinking in Java by Bruce Eckel. Perfect for one with some C# or C++ experience but not good for programming beginners.
 
IMHO, the best Java IDE out there is Intellij IDEA, but I would recommend against using it for a beginner. A text editor + terminal is the best way to learn. Once you've used that for a month or so you can go with the IDE of your choice.
 
I will try them all out and see which one works for me. I read the first few pages in the book for my class and it almost feels like I am reading the Objective-C book since they talk about Classes and Methods and it evolved from C++ which evolved from C.

Are there any big differences from Objective-C and Java?

-Lars
 
Are there any big differences from Objective-C and Java?

-Lars

Totally different approach to objects in Objective-C. Objective-C is C with a Smalltalk-like extension for objects. C#, which you mentioned, is like a merge of Java and C++, and so Java is easy to pick up from that point of reference.
 
OK so I will need to think about it a little differently even though they use the same terminology like Classes and Methods and so on. The book is 1500 pages or so, it should be fun.

-Lars
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.