Content deleted Content added
Fxgj Tags: Mobile edit Mobile web edit |
m Reverted 1 edit by 2405:205:330E:75B8:DBF4:8BFC:732D:3BD1 (talk) to last revision by 134.223.230.152 (TW) |
||
Line 1:
An '''interface''' in the [[Java (programming language)|Java programming language]] is an [[abstract type]] that is used to specify a behavior that [[class (computer science)|classes]] must implement. They are similar to [[Protocol (object-oriented programming)|protocol]]s. Interfaces are declared using the <code>interface</code> [[Java keywords|keyword]], and may only contain [[method signature]] and constant declarations (variable
Interfaces cannot be [[Instance (computer science)|instantiated]], but rather are implemented. A class that implements an interface must implement all of the non-default methods described in the interface, or be an [[abstract class]]. Object references in Java may be specified to be of an interface type; in each case, they must either be [[null pointer|null]], or be bound to an object that implements the interface.
|