Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

Practicing the basic concepts of java.

I am currently working my way through the Java Objects track and I'm finding that I understand the individual concepts as they're being introduced, however, remembering when and where to use things when I'm not being told is proving a lot more difficult. I need to think a little more for myself whilst not being over-faced with new concepts.

Does anyone have any suggestions for simple console applications that I could try to make myself without the help of a tutorial telling me exactly what I should do and where and when, but rather, just some guidelines about a general structure of the program.

Any help would be greatly appreciated :)

1 Answer

Brendon Butler
Brendon Butler
4,254 Points

One thing that I would do is to do a course or break up a course into parts and then go to an IDE (IntelliJ, Netbeans, Eclipse, etc.) and try to re-create whatever was in the lesson from memory. Just do this with all the courses. Eventually, some things like building new classes, creating main methods, and making constructors/methods/variables will start to come as second nature to you. Just keep practicing, you'll know when and where to use different things.

And don't fret, you won't always be right. Especially when it comes to optimization. There will almost always be a way to better optimize your code or better ways of doing certain things for security, performance or other reasons.

One thing I would suggest is trying to read or break down other people's code. Some code may look very advanced, but when you start with the main method and kinda break it down from there, you'll eventually start to understand how things work. Github is a great place for this. Here's a link to my friend's game: TextFighter. And a link to my slightly more advanced, yet far less finished game and the API I made for it: Visionless, ModestAPI.

One program that I try to recreate almost yearly (improving on the previous year's version), is a Magic 8 Ball style game. Maybe try making a word sorting program, that asks for words. Then once it's done asking, sort them alphabetically and output them to the user.

Look at your surroundings. Object-oriented programming will help you dissect different objects to figure out their functions, what they do, what they hold, etc. Take the Pez Dispenser course for example, and use those concepts to build a program based on say.. a vacuum cleaner!

Sorry for the late reply. Your advice has helped me a lot. I haven't been able to get to a PC in the last few days so I have been using an IDE for android, its very basic but it means that I don't have the convenience of auto complete so it's more helpful for figuring things out on my own. I set out with the idea of creating a list of grocery store items and sorting them based on name and price but ended up getting caught up making a menu Ui and I've just been refactoring and refactoring. The Text Fighter application has been the most help because I am able to search through it for a working example of something when I'm stuck and see new ways in which objects can interact with each other. Things are starting to fall into place in my mind with how to use Instance/Field variables, constructors and get/set methods and how public/private and static/non-static affect what data can be accessed and how to access it.

I know this is only the beginning but it's like grammar in a language. Once you know how the basic syntax works you can start expanding your vocabulary.