Looks like no one added any tags here yet for you.
Classes in Java
every class is a subclass of some other class (except for one)
the “Object” class defines several instance method that are inherited by every other class
toString() method, when you create a class u can write a new toString() method, when using the toString() if you concatat the object to a string it will automatically call the toString method
Designing a class to play the Card higher lower game
objects candidates
game, player, hand, card, deck, value, suit
card and deck are most obviously reusable
verbs that involed are the mthode
shuffle, deal, add remove card
BlackJackHand Class
extend the original hand class but include extra functionality
getBlackJackValue()
Inheritance
refers to the fact that one class can inherit part of or all of its structure and behavior from another class
Class A is the superclass, Class B is the subclass
Class B inherits from class A
Multiple Classes can be declared as subclasses of the super class
subclasses can be referred to as sibling class
Protected Acess
when you declare a method or member variable to be protected, you are saying that is part of the implementation of the class instead of the public interface
allows subclasses to reuse and modify that part of the implementation
Overriding an Inherited Method
the toString() method is designed to be overridden
provides customizable string representation of the objects in that subclass
Polymorphism
a method is polymorphic is the action performed by the method depends on the actual type of the object
Overriding
run time polymorphism
occurs between two classes using inheritance
array elements are stored in contiguous locations, making it easy to determine relative location of elements
methods involved must have the same name and same signature
at runtime java determines the actual object type and invokes the most specific overridden method
Overloading
compile time polymorphism
occurs within the class
insertion and deletion operations are slow as elements are supposed to be stored sequentially index wise
methods involved must have the same name but different signatures
Dynamic Dispatch
allows the selection of methods at runtime based on the actual object type rather than the reference type