More later P209 P210
abstract class
you don’t know what it exactly is, it’s usually abstract name, such as animal, canine, feline.
abstract method
abstract class can be concrete in subclass
all abstract methods MUST be implemented by the first concrete subclass down the inheritance tree.
Object
Every class in Java extends class Object.
Object is non-abstract class
some methods are marked final so they can’t be overridden. But some methods are encouraged to be overridden, such as hashCode(), equals(), toString(). more later
equals()
hashCode (now think it as a uni0que ID) see it chapter 17
getClass()
toString() (the result has some numbers you don’t need to care about
Java is a strongly-typed language.
Object o = new Ferrari();
o.goFast(); //Not legal!
The compile knows only
It should be Object d = myDogArrayList.get(0);
(Suppose that there are Dogs object
in array myDogArrayList
)
interface more need to learn
define
public interface Pet{}
implement
public class Dog extends Canine implements Pet{}