• Post Reply Bookmark Topic Watch Topic
  • New Topic

Best way to learn Java?  RSS feed

 
Ranch Hand
Posts: 51
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I understand that there is not one single "best" way to learn java, but what is one way you would recommend for me. For the past few months I have been learning Java in my free time, and can create simple programs and GUI's. The problem I find is that there are concepts that I don't quite understand, but when I go back and review them it just makes me more confused. Even when I do understand something, I often times don't see a practical use for it(ex. methods- I understand them but can't find a practical purpose in any of my programs).

I should mention that I'm learning Java simply on my own for fun, it's not for school or anything. So what I'm wondering is should I
- Develop programs that I want to and learn as I go
- Learn from a book/youtube video

Whenever I try to learn from a book or youtube video I lose interest as it seems boring.
I ultimately want to program some games, starting with something simple like shapes on screen then moving on. But I know that I need a solid understanding of the basics before I attempt game programming.
 
Sheriff
Posts: 22846
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I've found useful is to go through tutorials which include source code examples. Then I take the examples and start messing around with them, changing things and adding things to see what happens. That way I work with the concepts which the tutorial is supposed to be talking about and see what I can do with them. Just reading books about the concepts does tend to put me in that same frame of mind: "Huh? What's that all about?"

And as a general rule, if I want to learn about concept X in Java then my google keywords are "java X tutorial". Typically this leads me to an Oracle tutorial about concept X, and sometimes to tutorials from other sources. I've found the Oracle tutorials to be pretty good compared to those from other sources. That isn't universally true, but it's a good starting point.

It does help if you have a goal in mind, for example a program which you want to write. Then you can take bits from various tutorials and use them while you're developing various aspects of that program. But since you're a beginner, let me warn you, once you get that program finished you will most likely look back at it and realize what a terrible mess it is. That's because you wrote most of it when you didn't really know what you were doing. (At least this has been my experience.) At that point you may want to scrap the whole thing and start again, this time using the experience you gained the first time through. Don't be dismayed by this.
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John Corkrend wrote:
Whenever I try to learn from a book or youtube video I lose interest as it seems boring.
I ultimately want to program some games, starting with something simple like shapes on screen then moving on. But I know that I need a solid understanding of the basics before I attempt game programming.


Paul Clapham wrote:
It does help if you have a goal in mind, for example a program which you want to write. Then you can take bits from various tutorials and use them while you're developing various aspects of that program.


The boredom will come. No matter how interested you are in programming--or in anything for that matter--there will be parts of the learning process that are difficult, repetitive, tedious, and just not fun in general. In the end, if you want to get good at something, you'll have no choice but to gut through those times. Having said that, though, what Paul is saying is great advice, and if you do it right, it can take the edge off the boredom
.

So let's say you want to make a game like Minecraft. Writing "Hello World" and printing out the numbers from 1 to 100 and their squares is not even remotely close to that. You're going through these tutorials, gutting it out, thinking, "When do I get to do something even remotely interesting?" In the very beginning, it will be difficult or impossible to relate the exercises for the basic concepts to your goal in any meaningful way. At some point, though, there will be enough pieces that you can put them together to make something that's relevant to what you're ultimately trying to produce.

Maybe after you learn the basics of objects and constructors and member variables and console I/O, you can create a small app that has a bare minimum number of features that Minecraft has. A single Character, maybe 5 Locations, and maybe 5 Tools. (I don't really know Minecraft--I just kind of watch my kid play, so forgive any incorrect game terminology).

You have a simple game flow and simple console I/O. The 5 Locations are conceptually arranged in a line, one after the other, and the Character can only move forward or backward. Each Location has one Tool. If he moves forward, he picks up the Tool at the new Location. If he moves backward, he drops it. At each move, you print out where he is, what he's carrying, and what his options are (forward, backward, or both).

Done. That's it.

With that simple app, you can play around and study different ways of doing various things, and combine several concepts. And while it's a far cry from the real Minecraft game, it at least gives you a peek at some of the building blocks that might go into such an app. And since you already know how the game is supposed to behave, you can readily judge the correctness of your program and the progress you're making toward your ultimate goal.

Maybe the next pass he can carry a max of 3 tools, and once his hands are full, he can choose to drop one (Any one? First picked up only? Last picked up only?) and pick up another. Can he drop multiple tools in one location, or can each location only hold one tool?

As you learn more concepts--both Java and general CS--you can add characters, expand your map, make the play more sophisticated, etc.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oracle has an excellent collection of "tutorials" that teach you the entire language.
 
John Corkrend
Ranch Hand
Posts: 51
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeff Verdegan wrote:
John Corkrend wrote:
Whenever I try to learn from a book or youtube video I lose interest as it seems boring.
I ultimately want to program some games, starting with something simple like shapes on screen then moving on. But I know that I need a solid understanding of the basics before I attempt game programming.


Paul Clapham wrote:
It does help if you have a goal in mind, for example a program which you want to write. Then you can take bits from various tutorials and use them while you're developing various aspects of that program.


The boredom will come. No matter how interested you are in programming--or in anything for that matter--there will be parts of the learning process that are difficult, repetitive, tedious, and just not fun in general. In the end, if you want to get good at something, you'll have no choice but to gut through those times. Having said that, though, what Paul is saying is great advice, and if you do it right, it can take the edge off the boredom
.

So let's say you want to make a game like Minecraft. Writing "Hello World" and printing out the numbers from 1 to 100 and their squares is not even remotely close to that. You're going through these tutorials, gutting it out, thinking, "When do I get to do something even remotely interesting?" In the very beginning, it will be difficult or impossible to relate the exercises for the basic concepts to your goal in any meaningful way. At some point, though, there will be enough pieces that you can put them together to make something that's relevant to what you're ultimately trying to produce.

Maybe after you learn the basics of objects and constructors and member variables and console I/O, you can create a small app that has a bare minimum number of features that Minecraft has. A single Character, maybe 5 Locations, and maybe 5 Tools. (I don't really know Minecraft--I just kind of watch my kid play, so forgive any incorrect game terminology).

You have a simple game flow and simple console I/O. The 5 Locations are conceptually arranged in a line, one after the other, and the Character can only move forward or backward. Each Location has one Tool. If he moves forward, he picks up the Tool at the new Location. If he moves backward, he drops it. At each move, you print out where he is, what he's carrying, and what his options are (forward, backward, or both).

Done. That's it.

With that simple app, you can play around and study different ways of doing various things, and combine several concepts. And while it's a far cry from the real Minecraft game, it at least gives you a peek at some of the building blocks that might go into such an app. And since you already know how the game is supposed to behave, you can readily judge the correctness of your program and the progress you're making toward your ultimate goal.

Maybe the next pass he can carry a max of 3 tools, and once his hands are full, he can choose to drop one (Any one? First picked up only? Last picked up only?) and pick up another. Can he drop multiple tools in one location, or can each location only hold one tool?

As you learn more concepts--both Java and general CS--you can add characters, expand your map, make the play more sophisticated, etc.


So you're saying that I need to have an understanding of a few things before I move on to bigger things? Then the next thing I have to ask you is how do I know if I understand them?
For example I know about the basics of objects, they all have a state and a behavior. That state/behavior is given to them by methods, right. So do I understand them enough to move on or should I keep studying?

And I am setting goals for myself along the way which I so far I have met. I build myself up little by little, like I started with a simple GUI then added buttons and text, then received user input and later used that input to do something else in the program. I'm thinking my next goal to be writing to a file. Am I doing this ok so far by moving myself up little by little like this, or should I be doing something else.

Also when I do decide to do game programming, I believe I will start out with simple 2D games with shapes, and then move my way up. I think 3D is WAY above my head right now.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!