Interface (Java): Difference between revisions

Content deleted Content added
Monkbot (talk | contribs)
m Task 18 (cosmetic): eval 3 templates: hyphenate params (1×);
Line 91:
</syntaxhighlight>
 
Interfaces are commonly used in the Java language for [[Callback (computer science)|callbacks]],<ref>{{cite web |last1=Mitchell |first1=John D. |date=1996-06-01 |df=mdy |url=https://www.infoworld.com/article/2077462/java-tip-10--implement-callback-routines-in-java.html |title=Java Tip 10: Implement callback routines in Java |work=[[JavaWorld]] |accessdateaccess-date=2020-07-14}}</ref> as Java does not allow multiple inheritance of classes, nor does it allow the passing of methods (procedures) as arguments. Therefore, in order to pass a method as a parameter to a target method, current practice is to define and pass a reference to an interface as a means of supplying the signature and address of the parameter method to the target method rather than defining multiple variants of the target method to accommodate each possible calling class.
 
===Subinterfaces===