COMPSCI 61B Lecture Notes - Lecture 9: Type System, Hyponymy And Hypernymy
Document Summary
When a class is a hyponym of an interface, we used implements. If you want one class to be a hyponym of another class (instead of an interface), you use extends. Example: we want to build rotatingsllist that can perform sllist operation as well as: rotateright(): rotates list right and moves back item to the front. Remembers all items that have been destroyed by removelast. Has an additional method printlostitems(), which prints all deleted items. However, the rules of java say that all constructors must start with a call to one of the super class"s constructors. Can explicitly call the contributor with the keyword super (no dot) If you don"t explicitly call the constructor, java will automatically do it. If you want to use a super constructor other than the no-argument constructor, can give parameters to super. Every type in java is a descendant of the object class. Every object class has some fundamental functionalities tostring(), hashcode(), equals(object o)