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!
You have completed Java Objects!
Preview
Let's create our first method, a getter.
Learn more
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
No one outside
the class can even see the value.
0:00
We want to allow users of our object to
see the character name, but not change it.
0:02
So, how do we let them get the value then?
0:07
Great question. I'm glad I asked.
0:09
The answer is,
we build a method that exposes a value.
0:12
We've used methods before,
like printf on the console object
0:15
and to lowercase on strings.
0:19
Now, remember what I said, that developers
modeling real-world
0:21
objects focus on two main characteristics,
state and behavior.
0:24
Now, fields
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