Welcome to the Treehouse Community
Looking to learn something new?
Aditya Sheode1,291 Points
PezDispenser dispenser = new PezDispenser();
I have a few questions regarding the statement above
- He referred to PezDispenser as a data type why? 2.Why PezDispenser();? 3.How does he exactly point the example file to the Pezdispenser?
PezDispenser is the data type because it only allows information of the type PezDispenser. Or, put another way, if you use a primitive data type int, you can only use integers and nothing else - otherwise you'll get an error. Same with the class you've created.
The PezDispenser() points to the constructor in the Pez Dispenser class. A constructor is similar to a method in how it's called. Later on, you will learn about the arguments you can pass into the ().
He imported the class at the top of the page.