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 (Retired) Harnessing the Power of Objects Methods and Constants

Priscilla LLorenz-Lohn
Priscilla LLorenz-Lohn
622 Points

What is happening in min 2:20?

I'm a true beginner with java and after we decide to make a new PezDispenser, in min 2:20 a new line just appears "PezDispenser pd = PezDispenser@ed32a6b". What does that line mean? I can't seem to achieve that on my console. I tried just typing it in but I get an error "java.until.NoSuchElementException." Any help greatly appreciated.

1 Answer

That line is just the repl confirming that a new PezDispenser object was created, with "ed32a6b" being its location in memory. You'll never have to write anything like that, as the "new" keyword finds a location in memory for you. To reference that PezDispenser, you just need to use the variable name.

Priscilla LLorenz-Lohn
Priscilla LLorenz-Lohn
622 Points

Thank you! that clears it up for me. Also, I was able to get that line appear for me after reloading the workspace and trying again. For some reason that wasn't happening before.