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 trialKshatriiya .
1,464 PointsPlease confirm or correct what i've managed to gather from this video
Out of all the topics on here I'm finding this one to be the most challenging. This video threw around a lot of new topics but I personally found the explanation to be a bit shallow and rushed.
After scouring around the net for topics on interfaces I've come to several conclusion:
1) Comparable is an interface itself and implement keyword is how you implements this particular interface
2) interfaces are abstract classes, usually you would do interface animal() { } with empty method or variable declarations
3) the reason contract analogy is used is because any objects created under the interface abstract class must deploy all the methods declared in the interface
4) Comparable interface has only one method and it is compareTo() which only takes an Object as an argument
5) Object is the default super class of anything you create
6) Hence, you down cast obj in (Object obj) into Treet other = (Treet) obj;
7) Because compareTo() is a method of Comparable interface you must override it
8) toString() method is used to reduce class objects into a standard format so as to make them in comparable format
9) because toString() method is a method of the Super class Object you must override it in order to use it
I may have much more but please if you could answer these for me I would be really really grateful. Thank you in advance.