java - Why we need to implement certain methods when we extend classes in android? -
even if going empty.
for example oncreate method.
when write extends "some class name",a warning shown methods have implemented.
they abstract classes/methods , need overridden. can choose override functionality or let parent classs doing.
an abstract class class declared abstract—it may or may not include abstract methods. abstract classes cannot instantiated, can subclassed.
an abstract method method declared without implementation (without braces, , followed semicolon), this:
abstract void moveto(double deltax, double deltay);
if class includes abstract methods, class must declared abstract, in:
public abstract class graphicobject { // declare fields // declare nonabstract methods abstract void draw(); }
when abstract class subclassed, subclass provides implementations of abstract methods in parent class. however, if not, subclass must declared abstract.
Comments
Post a Comment