Jump to content

  • Log In with Google      Sign In   
  • Create Account


Best way to learn the basics of Java?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
16 replies to this topic

#1 Stevenx514   Members   -  Reputation: 100

Like
0Likes
Like

Posted 08 September 2011 - 11:48 AM

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?

Sponsor:

#2 Antheus   Members   -  Reputation: 2393

Like
0Likes
Like

Posted 08 September 2011 - 12:22 PM

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.

#3 Stevenx514   Members   -  Reputation: 100

Like
0Likes
Like

Posted 08 September 2011 - 12:34 PM

<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>

#4 HNikolas   Members   -  Reputation: 192

Like
1Likes
Like

Posted 08 September 2011 - 01:19 PM

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.
Ruby on Rails, ASP.NET MVC, jQuery and everything else web.. now also trying my hand on games.

#5 Infernal-rk   Members   -  Reputation: 135

Like
0Likes
Like

Posted 08 September 2011 - 04:05 PM

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.

#6 Stevenx514   Members   -  Reputation: 100

Like
0Likes
Like

Posted 08 September 2011 - 06:09 PM

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.

#7 jbadams   Senior Staff   -  Reputation: 17208

Like
1Likes
Like

Posted 08 September 2011 - 06:39 PM

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. Posted Image

#8 Stevenx514   Members   -  Reputation: 100

Like
0Likes
Like

Posted 08 September 2011 - 07:41 PM

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.




#9 Infernal-rk   Members   -  Reputation: 135

Like
0Likes
Like

Posted 09 September 2011 - 12:52 AM

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.

#10 jwezorek   Crossbones+   -  Reputation: 1606

Like
0Likes
Like

Posted 09 September 2011 - 01:59 AM

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.

#11 Adam_42   Crossbones+   -  Reputation: 2361

Like
0Likes
Like

Posted 09 September 2011 - 03:59 AM

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.

#12 Jesse7   Members   -  Reputation: 154

Like
0Likes
Like

Posted 09 September 2011 - 12:34 PM

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.

#13 Stevenx514   Members   -  Reputation: 100

Like
0Likes
Like

Posted 09 September 2011 - 02:03 PM

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.

#14 HNikolas   Members   -  Reputation: 192

Like
0Likes
Like

Posted 10 September 2011 - 01:03 AM

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
Ruby on Rails, ASP.NET MVC, jQuery and everything else web.. now also trying my hand on games.

#15 Gamer Gamester   Members   -  Reputation: 136

Like
0Likes
Like

Posted 10 September 2011 - 01:49 AM

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.

#16 dave j   Members   -  Reputation: 581

Like
0Likes
Like

Posted 10 September 2011 - 04:52 AM

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.

#17 Stevenx514   Members   -  Reputation: 100

Like
0Likes
Like

Posted 10 September 2011 - 03:50 PM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS