Welcome to the Treehouse Community
Looking to learn something new?
Simon Johnson1,277 Points
List and explanations of keywords for reference
I was following up until this point, but the level (like so many times I have tried to learn programming languages in the past) has ramped up significantly from the previous course.
I am sure I am not the only one but I feel like I am being lost a little bit with the number of "new" keywords banded around in each subsequent video.
I know I can refer to the Oracle Java documentation, but most of that, at least at the moment, just adds more confusion.
Can anybody point me to, or can I suggest an addition to the Teacher's notes on each video; a summary of the "new" keywords, and their definition and significance within the video or current module.
I am making plenty of notes as I go along and even stopping at the end of each video and downloading the srt file to read the transcript, but still feeling a little lost.
Thanks in advance.
OK - now, I'll confess to having never come across a Pez before doing this course; it is still something I've never used so it isn't real-world example to me. Craig pointed me in the right direction when I asked him!
PezDispenser is the class (the template).
PezDispenser() is the constructor and
dispenser is the variable the instance of the class is assigned to.
dispenser holds the instance of
PezDispenser that is created by using the
new PezDispenser() line.
GoKart thing is similar. The keyword
GoKart is the class itself which is created/instantiated by using
new GoKart() (the constructor) but this constructor wants a parameter (something that you give the constructor to construct the GoKart you want. In this instance, you want to create a coloured kart; let's say we want a green one ...
GoKart simonKart = new GoKart("green");
That creates a variable called
simonKart that is waiting to hold a
GoKart sized object (that's the left hand side of the equals sign done). We then create a
GoKart using the constructor that takes a colour. The
new keyword then uses the constructor with a string
GoKart("green") that creates the object. The equals sign puts the object created to the right of it into the space generated to its left.
I hope that helps!
Don't be alarmed; many students get confused at these new concepts. Keeping at it and gaining familiarity of them is the key to really understanding them.
I don't have a list (but I'm happy to put one together if you let know what's causing you trouble) but I did write a post on various keywords that you've just come across. Please have a read of this post to see if that either helps or allows you to articulate further questions that I hope to be able to help with!
Keep me posted.