Extends is inheriting a class
Methods that can use the parent class after inheritance
You can also override methods of the parent class
Implements is the implementation of multiple interfaces
The method of the interface is generally empty
Must be overridden to use
Extends is inherited from the parent class, as long as that class is not declared final or the class is defined as abstract and can be inherited, multiple inheritance is not supported in Java, but it can be implemented using interfaces, which means that inheritance can only inherit a class, implements, But implements can implement multiple interfaces, separated by commas.
Like what
Class A extends B implements C,d,e
Extends inheritance class implements implementation interface
Classes and interfaces are different. A program is implemented in a class, and the interface has no program implementation, only the predefined method extends the inheriting class
Implements implementation interface
Java also provides an inheritance mechanism, but it also provides a concept called interface. Because the Java inheritance mechanism can only provide a single inheritance (that is, only one parent class can be inherited), it replaces the multiple inheritance of C + + with Java interface. Interface is a kind of interface, which stipulates the communication of two objects, which are the norms of communication. For example, the interface of,java in the Java programming language means that some functions or data members are shared by other objects belonging to different classes, and these functions are defined in a interface with the data member, Then let all the different classes of Java objects be used together.
So, for Java inheritance and interface,, we summarize the following:
The 1.Java class can inherit only one parent class (with the extends keyword), but can have (or implement) many interface (with the Implements keyword).
What is the difference between Q5.1 extends and implements?
A: For class, extends is used (single) to Inherit a class (class), whereas implements is used to implement
An interface (Interf
ACE).
Interface is introduced to partially provide multiple inheritance functions.
In interface, you simply declare the method header and leave the method body to the implemented class.
The instances of the class that are implemented can be treated as interface instances.
The relationship between interface can also be declared as extends (multiple inheritance).
Note that a interface can extends multiple other interface.