为什么我们在android中扩展类时需要实现某些方法?

Why we need to implement certain methods when we extend classes in android?

Even if they are going to be empty.

例如oncreate方法。

当我们写extends "some class name"时,会出现一个警告,提示必须实现某些方法。

它们是 abstract classes/methods 并且需要被覆盖。您可以选择覆盖功能或让它做父类正在做的事情。

An abstract class is a class that is declared abstract—it may or may not include abstract methods. Abstract classes cannot be instantiated, but they can be subclassed.

An abstract method is a method that is declared without an implementation (without braces, and followed by a semicolon), like this:

abstract void moveTo(double deltaX, double deltaY);

If a class includes abstract methods, then the class itself must be declared abstract, as in:

public abstract class GraphicObject {
   // declare fields
   // declare nonabstract methods
   abstract void draw();
}

When an abstract class is subclassed, the subclass usually provides implementations for all of the abstract methods in its parent class. However, if it does not, then the subclass must also be declared abstract.