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 trialKhanh Dao
641 PointsIs it right that if the java file are in the same folder you could easily access between them and not use "extends"?
Craig in the video access the characterName without anything. System.out.printf("The dispenser is %s %n", dispenser.characterName); while the variable characterName is in PezDispenser.java.
rajan lagah
2,539 Pointsrajan lagah
2,539 Pointsto use the String of PezDispenser.java class u need to create the object of that class(Pez....); for example java have Stack class (with many method in it like add(),pop()) to access them u need to import that class(Stack) and make its Object and use that class features. but if the folder of file is same then no need to import it. extend is different thing. when u want your class have some same feature that other class have u will extend it (mean ur new class will have sane feature (override is case))
imagine class1 as a remote1 class 2 as a remote2
to use features of button on remote1/remote2 u have to create object of remote1/remote2 but if u want remote2 to have some feature(buttons) of remote1 on it ,u will extend remote1 to remote2
hope this help