public class SuperClass {
public void someInterestingMethod() {
System.out.println("Superclass!");
}
}
public class DerivedClass extends SuperClass {
public void someInterestngMethod() {
System.out.println("Derived class!");
}
}
当你这样做的时候:
SuperClass sc = new DerivedClass();
sc.someInterestingMethod();
public class SomeClass {
@Override
public String toString() {
return "SomeClass";
}
@Deprecated
public void doSomeOperation() {
// some operation...
}
}