This course will be retired on July 31, 2026. We recommend "Practice Java Objects - Word Guessing Game" for up-to-date content.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Java Objects (2016)!
You have completed Java Objects (2016)!
Preview
Access level modifiers such as public and private help to explain our intent.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
We made a field that exposes
the character's name, and not
0:00
only can we access the field to get the
current value, but we can also change it.
0:00
Now in real life, we can't really
change the character of a PezDispenser
0:05
after it's been created, can we?
0:08
Yet, as we saw,
0:10
you can do exactly that with the newly
created object we just made.
0:11
We never want people to misuse the object
that we allowed them to create.
0:15
But it's kind of only us to blame, right?
0:18
We allowed that to happen.
0:21
We should make it as clear as
possible to consumers of our class,
0:23
how we intend them to use it.
0:27
Now when I say consumers,
0:29
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up