Extends
extends is to inherit one class to the other class. parent classes —>sub classes
If a method was called in another method and the object is from outside of the class, we just called it directly and not add xxx.xxx here.If it is from inside of a class, we will use xxx.xxx to call the inner methods.(如果在一个method里面调用另外一个method时,如果在class外面的对象时,就直接调用另外一个方法,比如:
public class RotateSLList<Blorp> extends SLList<Blorp> {
public void rotate() {
Blorp x = removeLast();
addFirst(x);
public static void main(String[] args) {
RotateSLList<String> Rl = new RotateSLList<String>();
RladdLast("haha);
}
)
Extends Inheritance: Only inherit all the members of the parents’ class.
all the members:
All instance and static variables
All methods
All nested classes
**Constructors are not inherited, private classes can not be accessed directly by subclasses **
Cast只能暂时cast