Method Hiding (5 rules)
Constructor definition (5 rules)
super() vs super
super(), is a statement that explicitly calls a parent constructor and may only be used in
the first line of a constructor of a child class.
The second, super, is a keyword used to reference a member defined in a parent class and may be used throughout the child class
OCA will try to trick you. Look at how super() and super are used:
public Rabbit(int age) {
super();
super.setAge(10);
}
public Rabbit(int age) {
super; // DOES NOT COMPILE
super().setAge(10); // DOES NOT COMPILE
}
Method Overriding (4 rules)
final methods
final methods cannot be overridden.
Defining an interface (5 rules)
Inheriting an Interface (2 rules)
Interface Variables (2 rules)
Default Interface Methods (4 rules)
Static Interface Methods (2 rules)
Polymorphism
The property of an object to take on many different forms.
A Java object may be accessed using a reference with the same type
as the object, a reference that is a superclass of the object, or a reference that defi nes an
interface the object implements, either directly or through a superclass. Furthermore, a cast
is not required if the object is being reassigned to a super type or interface of the object.
Casting Variables (4 rules)
Objects Vs. Reference (2 rules)
In Java, all objects are accessed by reference, so as a developer you never have direct access
to the object itself. Conceptually, though, you should consider the object as the entity that
exists in memory, allocated by the Java runtime environment. Regardless of the type of the
reference you have for the object in memory, the object itself doesn’t change.
Concrete class
A concrete class is the first nonabstract subclass that extends an abstract class and is required to implement all inherited abstract methods.
When you see a concrete class extending an abstract class on the exam, check that it implements all of the required abstract methods.