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 trialMUZ140265 Blessing Kabasa
4,996 PointsPliz explain, on line 6 there is Game game & on line 11 there is Console console, what is the difference btwn Game game
On line 6 there is Game game. What is the difference between the two. on line 11 there is Console console...what is the difference and the significance of the two words?
2 Answers
Gloria Dwomoh
13,116 PointsGame game creates an object called "game" of the class Game, while Console console creates an object of the Console class named "console" those names were added for simplicity to remind which class are they related to.
Craig Dennis
Treehouse TeacherThe capitalized version is the type and the lowercased is the variable name it could be anything.
Type variableName = new Type();
Adiv Abramson
6,919 PointsI wonder why in Java it's OK to name variables or identifiers after built in or custom classes. I know Java is case sensitive so Game != game and Prompter != prompter and Console != console but it's rather confusing to me. Since I have a VB6/VBA background, I prefer prefixing the identifier name with a TLA for its type, e.g. Console is the Java object. An instance of it might be named objConsole or even my_console.
Is it standard and recommended practice in Java to name identifiers after built in classes or other keywords, merely changing the case where applicable? Thanks!