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

Android

Jason Holt
Jason Holt
10,041 Points

Best way to enhance learning?

I have just finished the first part of the Android course. There are a lot of things that I just gained a cursory understanding of, especially related to the coding in Java. How can I get a better understanding of Objects, Classes, Methods, etc. I don't feel like I have a firm grasp on it. Are there some other ways I can practice using these skills?

3 Answers

OOP is a challenging concept to grasp. One day it will click though! The way I think of an class is like a blueprint of an Item... like the blueprint of a Car. I can give the car fields or properties .. like wheels, color, make, and model. I can give the car a 'drive' method.. which is an action the car can do. Then I can make an Object instance of that Car which is actually building a real 'tangible' Car.

public Class Car {
    String make;
    String model;
    String color;
    Int numberOfDoors;

    public void Drive(){

        System.out.println('Driving the car.. ' + this.make);
    }

}

Then we can make a new Car somewhere else in our code... the actual Object. the literal 'tangible' object that you can use.

Car pontiacG6 = new Car();

pontiacG6.make = "pontiac";
pontiacG6.model = "G6";

pontiacG6.color= "silver";

pontiacG6.numberOfDoors = 4;

pontiacG6.Drive();
Jason Holt
Jason Holt
10,041 Points

This is a helpful visual. Thank you.

In this case, the method is

public void Drive

and the properties of the car are the Class

public Class Car.

Is a class and an object the same thing then? Or is it more like, a class is a blueprint and an object is the actual object?

Mahesh Patel
Mahesh Patel
3,376 Points

find other people to learn with. I have Dyslexia, when it comes to reading and writing a 5th grader is better then me. Videos and letting my macbook read back to me really help. I would just watch the videos fully with out doing anything and then if I understand it I follow along. I'm the only 35 year old nerd that wants to learn to code in my group of friends so its hard for me but learning with other people really helps. something that you don't understand your friend might do better and can explain. just keep at it, it will click in at some point.

Jason Holt
Jason Holt
10,041 Points

I have started doing what you suggested. I'll watch the videos once through; just watch. Then the second time through I will work along with the speaker and take notes. Thanks for your help!

Yes Jason, a class is like the blueprint for a tangible objects.. The schematics. The example I provided is a bit shallow, there is more to object oriented programming topics. Check out key concepts like, inheritance, polymorphism,constructors, the difference between a field and a property, setters and getters, scope, etc..