Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Did Java invent interfaces?

I know about C++ pure virtual classes, but Java went one step further and created a first-class (no pun intended) concept for multiple-interface (not implementation) inheritance, the interface. It's now a staple of major statically-typed languages. Did Java invent the interface concept? Or did it appear in older languages also as a first-class concept?

like image 436
Jordão Avatar asked May 03 '10 13:05

Jordão


2 Answers

Here is abstract from the article The Java Language Environment.

An interface in the Java language is simply a specification of methods that an object declares it implements. An interface does not include instance variables or implementation code--only declarations of constants and methods. The concept of an interface in the Java language was borrowed from the Objective-C concept of a protocol.

http://java.sun.com/docs/white/langenv/Object.doc2.html#6185

like image 177
Sharjeel Aziz Avatar answered Sep 30 '22 12:09

Sharjeel Aziz


As far as I know Objective-C was the first language to feature interfaces. At least it had them before Java was invented.

like image 30
ahe Avatar answered Sep 30 '22 12:09

ahe