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

B1gMac

macrumors regular
Original poster
Jun 2, 2008
150
0
Hey guys, I wasn't really sure where would be best to ask this question, but I guess you guys could at least point me in the direction of the answer.

Basically, I am a rising college freshman. I hope to take the intro Computer Science class this fall. But, for many people this can be a challenging course, and I wanted to try and expose myself to some java beforehand.

So, my question is: What would be the best online or print source, that is hopefully free, that I could use to try and learn a bit of java. I come in with experience in WYSIWYG web-design skills with a good amount of html code experience. I only once have used javascript to essentially automatically add 3 different numbers together (very basic) on a webpage of mine. So, what might you recommend for someone who will hopefully eventually explore very advanced topics, and is not quite coding-illiterate?

Edit:
If it makes a difference, the class will teach java programming on a mac, using a program called eclipse.
 

Mac Player

macrumors regular
Jan 19, 2006
225
0
Sun's tutorials are very good. Save your money for books on algorithms.

Since this is your first course in programming I recommend you not to use eclipse, a regular text editor and the compiler will do.
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
I would recommend the O'Reilly books on Java.
Learning Java
http://oreilly.com/catalog/9780596008734/

and

Java in a Nutshell
http://oreilly.com/catalog/9780596007737/

The latter was the book we used in my first college CS course, though I'm sure an earlier version.

I'm not too sure about websites.

What you need to learn the most about, which won't come from those books, is how to program period. Learning Java without any background on algorithms , data structures, object-oriented design, etc. may be somewhat fruitless. Java is strictly Object-Oriented, so if you don't know what an Object is or what you might want to use it for (which it doesn't sound like you got to in your javascript experience) you may have a tough time.

Eclipse is a fine IDE, but it will be quite easy to get bogged down in its details and nuance while trying to learn Java. The IDE that many of my peers used was BlueJ. It is awful, do not use it. I used JBuilder while I was in school, and it was pretty good, and did a good job of staying out of your way. I've recently used NetBeans and Eclipse, and I think NetBeans does a better job of staying out of your way than Eclipse. With Eclipse it's very difficult to get a project out of there (as is the case with most IDEs) and you have to learn a whole nomenclature that is used to describe tasks in Eclipse. Knowing what a perspective means in Eclipse, or what a facet is, doesn't help you learn Java.

I guess my perspective is that you should start with one of the O'Reilly texts and perhaps post here or other programming related forums when you have problems. You will at least be able to familiarize yourself with the language syntax which might give you a bit of a leg up. I don't know if you will want to try to delve into some of the programming concepts on your own, and don't really know a good text to recommend for a beginner. You're already paying a hefty sum to have someone teach you these things. I would hate for you to spend a lot of time half learning or mislearning certain concepts that you then have to break yourself of once you're being taught formally.

I don't mean to discourage you, but be prepared to do a lot of reading and not a lot of programming for a while. If you are properly motivated I'm sure in the next few months you can pick up quite a bit.

-Lee
 

Zortrium

macrumors 6502
Jun 23, 2003
461
0
I agree with Lee about Eclipse (nice IDE but not good for starting) but disagree about BlueJ - I used it when I first learned Java (in my first CS course) and found that it was perfectly fine for a beginner. Then again, there are good reasons to just go the text editor approach for awhile too.

I'd also agree that there's probably no need to go out and spend lots of money on books. Java is widely enough used to have scads of online documentation/tutorials, which are generally fine for learning.

Lastly, my experience both taking and TAing an intro CS course in Java (similar to what you're describing) is that people either tend to find it frustratingly difficult or pretty straightforward depending on how they take to programming - generally, of course, people in the former category don't go on to take higher-level CS.
 

Cool6324

macrumors member
Sep 18, 2007
62
7
Raleigh, NC
I am a 2nd year CS student. I just completed an intro programming course in Java. It was not challenging at all; although I had lots of previous experience (not book wise) writing programs for the Sidekick. Do any and all assignments, as I saw this kill a lot of the students who didn't do them. Ask questions and feel free to post here or drop me a PM so you can have extra help. My outlook is that 90% of learning comes from experience and 10% is reading. We did use eclipse in my class because it made things easier to run; versus running javac and java from the command line (or terminal). Learn how to run programs in your mind; all exams were hand written so be prepared to write code without a computer. A large portion of my class failed (more than 80%) because they simply did not do the programming assignments. Oh if you're wondering I got an A in the class. :D

Here's a snippet of Java:

Code:
public class reverse {


	public static void main(String[] args) {
		String s = "racecar";

		for(int x = s.length() - 1; x >= 0 ; x--) {
		System.out.print(s.charAt(x));

		}
		 

	}

}

You can run that code inside of eclipse, just make a class file titled reverse. Good luck in college!
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
I guess my beef with BlueJ was the way it invoked things. It ran your code in a separate thread in the same VM, so some things like System.exit() would shut down the IDE, which was pretty unfortunate.

Until you have projects that encompass a few dozen source files I don't think you need any IDE at all. I always think it's a good idea to learn vi(m), but some around here think it's too hard. Even if you don't do that, I think just using a text editor and compiling/running from the command line with java and javac (and perhaps learning the basics of jar) is the best way to go.

If you don't know how to do these things outside of an IDE it will be pretty embarrassing if you ever need to demonstrate your programs behavior on a machine without your IDE of choice, etc. It also gives you a better idea of what's going on. That, to me, is the major shortcoming of starting with an IDE. You don't know the details and this can leave you crippled when an IDE is not around.

Also, as Zortrium stated, on tests you don't have an IDE. You don't have a text editor. You don't have a compiler. You have pencil and paper, and you need to be able to write code without Code Completion/Code Insight/etc. and make sure you know the syntax without nice highlighting and automatic bracket matching, etc. I do think that testing in this manner is a bit unrealistic, as you'd never actually code that way. But it does make you really think about a problem and be able to plan it in your head, rather than the brute force method you might use otherwise.

Start here if you don't want a book:
http://java.sun.com/docs/books/tutorial/

Good luck, get reading, then get coding.

-Lee
 

myjay610

macrumors regular
Jan 6, 2008
131
0
I don't think eclipse is that scary if you just take the time to learn it...chances are your prof and TAs will have a preferred IDE that they can suggest so you might want to just find out what it's going to be.

A tip for later in your college career is to take a good class or two in C and/or C++ :)
 

myjay610

macrumors regular
Jan 6, 2008
131
0
oops.. I just saw your Edit...if they are going to use eclipse I say might as well learn it. You'll have to once you do start doing exercises in debugging anyway.
 

B1gMac

macrumors regular
Original poster
Jun 2, 2008
150
0
Wow! Thanks for the great responses guys! I am in the process of looking at some of these books. I'll be sure to contact those of you who offered to help this fall!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.