Head First Java Chapter 08 Notes

Head First Java Chapter 08

This is the eighth Chapter learning of Head First Java by Kathy Sierra and Bert Bates,
This markdown file is my notes for the eighth chapter, not sure if any copyright issues are there.

BULLET POINTS

  • When you don’t want a class to be instantiated mark the class with the abstract keywords.
  • An abstract class can have both abstract and non-abstract methods.
  • If a class has even one abstract method, the class must be marked abstract.
  • An Abstract method has no body, and the declaration ends with a semi-colon.
  • All abstract method must be implemented in the first concrete subclass in the inheritance tree.
  • Every class in java is either a direct or indirect subclass of class Object.
  • Methods can be declared with Object arguments and/or return types.
  • You can call methods on an object only if the methods are in the class used as a reference variable type, regardless
    of the actual object type.
  • A reference variable of type Object can’t be assigned to any other reference type without a cast, but at runtime
    the cast will fail if the object on the heap is NOT a type compatible with the cast.
  • All objects come out of the ArrayList<object> as type object.
  • Multiple inheritance is not allowed in java because of the problems associated with the ‘Deadly Diamond of Death’.
  • An interface is like a 100% pure abstract class. It defines only abstract methods.
  • Create an interface using the interface keyword instead of the word class.
  • Implement an interface using the key word implements.
  • Your class can implement multiple interfaces.
  • A class that implements an interface must implement all the methods of the interface, since all interface methods
    are implicitly public and abstract
    .
  • To invoke the superclass version of a method from a subclass that’e overridden the method use the super keywords.
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s