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 trial

Java Java Objects Harnessing the Power of Objects Constants

Pedro Araya
Pedro Araya
1,912 Points

what means pd?

what means "pd" in jshell, what it does?

2 Answers

Hello Pedro,

"pd" is just the name of the object that Craig created. You could call it pretty much anything you want, for example:

PezDispenser pedro = new PezDispenser("Hulk");

would simply create a new object called pedro which can be used to reference to the methods in your PezDispenser class. It would look something like this, assuming you know how method calls work:

System.out.printf("The Pez character is: %s %n", pedro.getCharacterName()); //getCharacterName is the method from you PezDispenser.java class.

As Craig also said in the video, "pd" might not be the best name to give the object as it could stand for multiple things such as "police department" and might confuse yourself later on or other developers that'll possibly work on your code with you.

I hope this eased it for you just a bit, let me and the others know if it helped you!

I believe it stands for PezDispenser! (: