ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

Java Interfaces - huh?

(1/1)

Josh:
I know there are some very well versed people on doco that are likely to understand this concept. Can someone explain to me how and why I would use a Java interface? I am coming from a VB/C++ background and really cannot wrap my head around why to use an interface.

Thoughts?

Eóin:
A Java interface in what sense? As in an interface class?

If that's what you mean well they are like a purely abstract C++ class.

Multiple inheritance from non-abstract base classes seems to generally be considered "a bad thing" among many developers. So Java went the decision of only allowing single inheritance from a concrete class and multiple inheritance from interface classes.

mouser:
What I told josh when he asked me this question, is that this is actually one of the more interesting and hot topics in programming language design.. the debate between Interfaces and OOP Inheritance.

It is well worth reading up on.. Perhaps people can recommend their favorite essays on the subject after a little web searching..

Josh:
I am going through the basics of learning Java and stumbled on this page at oracle: http://docs.oracle.com/javase/tutorial/java/concepts/interface.html

This is where I started my search for info on interfaces and I figured, what better place to ask about them than doco?

Navigation

[0] Message Index

Go to full version