Best way to learn the basics of Java?

Started by
15 comments, last by Stevenx514 12 years, 7 months ago
When I was at university, lecture rooms were never full, although the more practical portions of a course might have had a limited number of places due to say each student needing a computer. You might just be able to find out where and when the lectures are and show up to them so you don't miss the whole thing.
Advertisement

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?


When I read the phrase, "the best way to learn," it tells me that you're convinced that there is some kind of "canonical" method for learning a programming language like Java. I'll save you the trouble of searching for one--there isn't such a thing. If you want to be a writer, then you need to write. If you want to be a runner, then you need to run. Similarly, if you want to be a programmer, then you need to program. Program what? Anything. A programmer can't help but program. If just thinking of learning a new programming language doesn't get you all worked up and excited and ready to crank out code all night long, then you may want to rethink your area of study.
Good judgment comes from experience; experience comes from bad judgment.
I have to take a C++ course next semester so I'll learn to program one way or the other. I've only been practicing for about a week, but I feel like I've learned a lot. Simple code examples don't look completely foreign to me anymore. I am interested in programming. It amazes me how people can go from lines of code to three-dimensional video games etc. It's not that I lack determination, I just didn't know where to start. I'm devoting a lot of time to this, and I didn't want to waste my time doing the wrong things.
If you really are into game programming, then I suggest you to finish the book and get a strong basic knowledge of the language and how it works. There is no need to know the whole language library from the top of the head but you need to be a good google user to find solutions to the many problems you are going to face.

If you want to skip ahead and see how a simple game is made, then I suggest you to google basic java game tutorials, there are many on the WWW, some better then the others.


Some phrases to google:
game loop AND java
basic game tutorial AND java
2d game tutorial AND java



I think that writing simple games to learn a language, especially an OOP one, is another great way of doing it, so I will list few game frameworks.

Some of these frameworks will get months of work off your shoulders:
JGame (great and very easy framework)
GTGE
Slick2D
Shaven Puppy Game Library
Basilisk Game Library
[size=2]Ruby on Rails, ASP.NET MVC, jQuery and everything else web.. now also trying my hand on games.
You can learn your first programming language without taking classes, but you'll have to be very disciplined with yourself. If you try this, I recommend striving to be thorough with learning the core syntax. You don't have to study all the standard Java Libraries as thoroughly as as the syntax (but do learn the common, crucial packages and classes -- a good Java book will probably focus on these).



It's impossible to fully digest what your reading and studying without experience, and likewise, it's hard to gain good experience without first studying. What works best is probably an iterative approach: study, then experiment and play, then study again, then experiment, then study again that stuff you studied the first time, play around with what you're learning some more, etc.
You could have a look at Robocode. It was originally written by someone at IBM as a way to help people learn programming in Java. The idea is you write code to control a tank and test it in battles against other people's tanks - so it makes a good introduction to writing games as well.
I've looked at a tutorial on how to make pong in Java. I copied the code into my compiler and was amazed. Dave, I think you're right. I'm reading lecture notes and the assigned sections of the textbook daily, along with the example exercises. I also have a friend who's been programming for years who is helping me understand some of the concepts. Robocode seems like it will be fun once I get the hang of it.

This topic is closed to new replies.

Advertisement