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 trialabcd abcd
604 Pointsprivate Game mGame
i know this is a variable, but how does the Game becomes a variable data type why do we call it instead of calling String, char etc?
1 Answer
hbdc
13,725 PointsWell, it does not exactly become a variable. It becomes an istance of a class, or an object.
In other words this is how you create a new object which you can then later use - call methods and access it's own variables.
abcd abcd
604 Pointsabcd abcd
604 Pointsok, it finally makes sense now. Thanks!
Hemen Nabi
15,192 PointsHemen Nabi
15,192 PointsIn other word, this would be object composition in Java, i.e. the use of instance variables that refer to other objects?