Best way to learn the basics of Java?

Started by
15 comments, last by Stevenx514 12 years, 8 months ago
I'm a CS major and we're required to take an introductory Java course first semester. I signed up late and the course is full, so I have to attempt to test out next semester if I don't want to be a semester behind. My friend who took the test told me if you could program, you would be fine. I've been reading from my textbook and the java tutorials at Oracle. I copy code into my compiler and try to understand what each line does. I attempt to write my own code, but I usually have to look at examples to get the syntax right. If I continue this for an hour or two each day all semester will I be okay? Any suggestions?
Advertisement
It's like all the other languages you already know.

You do love programming, which is what made you sign up for CS in the first place, right?

If not, switch to math or physics. Or law.

Honest advice.
<div>I've never programmed in any language before. A better question would be "How do people learn to program in general?" My high school didn't offer any programming classes, and believe it or not there are a lot of freshmen CS majors who have never programmed.</div>
While the way you are learning it can surely work, I personally would concentrate my learning to the right things with a proper teacher. If you have the bucks to give out, order a book from Amazon.

There are many books that cover the topic. Java for Dummies(432 pages) and Head first Java(688) are really good picks for beginner and easy to follow or if these do not suit you, you could pick something else.
When learning with book and if the book has examples, be sure to complete them. In addition, making up your own problems that apply the concepts you learned is a great way too.
[size=2]Ruby on Rails, ASP.NET MVC, jQuery and everything else web.. now also trying my hand on games.
Reading your textbook like you are doing is a good start, but it really depends on the textbook. You can burn through java for dummies quite fast and probably pick up the language quickly too. Why not do both.

Find people in the class and get copies of the assignment questions. Do them as well. Then find someone who got a high mark on the assignments and compare your results.

Do more than the assignments and examples. I agree with HNikolas, you really start to learn the concepts when you apply them to your own ideas.

Hopefully with the textbook you are going to learn the same material as people in class. You should see about arranging a deal to potocopy someone's notes for a fee if you want to verify this.

Because you are new to programming, it might not seem easy, but being an introductory class, you can take to heart that they shouldn't be going crazy into high design or all out OOP right off the bat and it will be easy.


"How do people learn to program?"
Ever broken a problem down into smaller parts to solve indivdually and put them together for the final solution? Congratulations, you know how to program. The rest is all syntax, containers and algorithms.
Thanks for the replies. I'm going to order a copy of Java for Dummies. It will be a lot easier to lug around than my 600 page spiral-bound textbook. Luckily the professor posts all the notes and assignments online, so I should have my work cut out for me.
You need to write code to learn how to program -- it doesn't have to be good code, and mistakes will provide many of your best learning opportunities, but you need to be writing code -- the way you're starting out by pasting things in is a good start, but you'll need to learn to solve problems as well, it isn't enough to figure out what the functions do if you can't put them together to solve a problem.

Don't worry about having to look things up at first, that's perfectly normal, and even experienced programmers still rely on references sometimes. You'll find that as you get more practice and experience you will remember more and more and won't have to look up the simpler stuff.


Do all the practice problems you can get your hand on, and get feedback on your solutions -- find out if there are different ways you could have solved the problem, and what the strengths and weaknesses of the different approaches are. Try changing things and seeing what happens. Cause errors on purpose and learn to look up the error messages -- you'll probably also get familiar with some of the common errors.


Practice, practice, practice. cool.gif

- Jason Astle-Adams

I just found a site that has weekly problems for my course, such as "Create two chemical element objects. Each element object has the following attributes... Our program must input each of these attributes from console. The program must prompt the user for data and create a new object for that element." I think a combination of reading and solving problems like these daily all semester will be enough preparation.


I agree with the practice practice part but considering you have never programmed before, you need to learn some of the standard parts of programming languages and only a book or a teacher or experienced programmer will explain that in any meaningful way.

You cannot program if you do not know how to use variables, branching, looping, console I/O etc. they are simple and they are the basics but you can't really do anything in a program until you know what those things are and how to implement them in whatever language you are working in. Once you've learned these ideas in one language, moving to another it really does just become a case of similar yet newish syntax.
Look, no offense, but be a semester behind. Catch up when you're a sophomore or a junior by taking a heavy load or something.

You don't know how to program. The point of introductory programming classes is to teach you how program. It isn't about Java or the syntax of Java -- the language doesn't really matter. The introductory classes are the most important ones.

This topic is closed to new replies.

Advertisement