4 ms·
Java8 will allow method implementations in interfaces called default methods. http://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html http://docs
by kooshball 13y ago
Java8 will allow method implementations in interfaces called default methods.
http://docs.oracle.com/javase/tutorial/java/IandI/defaultmethods.html http://docs.oracle.com/javase/tutorial/java/IandI/defaultmet...
- auvrw 13y agoso the (only?) difference between an interface and an abstract class in java8 is that interfaces can't have data members.
- nly 13y agoMy Java is rusty (which I'm happy about) but presumably you're still restricted to single inheritance, whereas you can implement multiple interfaces? It's kind of sad how C++s object model is now actually a lot less complex than Javas and still more powerful.
- auvrw 13y ago> whereas you can implement multiple interfaces? right, duh/derp.
- richardwhiuk 13y agoI disagree: - virtual / none virtual functions - virtual / non virtual inheritance - pointers and references - templates I have to say that multiple inheritance normally means you are using the wrong design pattern, and you should be doing composition instead.
- nly 13y agoAll functions in Java are virtual, C++ just lets you make the performance trade-off. Virtual inheritance is only useful in a few cases in complex inheritance hierarchies, and most never need to know it exists. The other 2 aspects of C++ are nothing to do with the object model.
- judk 13y agoAh, Java8. What Java5 should have been, but for Sun being too busy dying and taking Java with it. Java: 20th Century technology... TODAY
- lutusp 13y agoJava just might become the Fortran of the 21st century -- embarrassingly out of date, but due to vast amounts of legacy code, impossible to get rid of.
- SomeoneWeird 13y agoisn't it already?
- gordaco 13y agoEdit: I misread you and I interpreted that you meant Java was already a legacy and out of date language. So my answer is a little out of place, although I don't think there's any harm in keeping it here. I disagree. I know that Java gets a lot of hate, here and in a lot of places, and I won't deny that a lot of it is indeed very well deserved, but it's far from being a "legacy" language. A quite large amount of software is being developed nowadays in Java, and in many cases, there are good reasons for that. About the "embarrassingly out of date" part, I also think that's too exagerated. Java was never intended to be a cutting edge language, but a reliable set of well-proven techniques. Java doesn't want to be Haskell, doesn't want to be Ruby, and doesn't want to be Lisp; and explicitly so. Java has modest design goals; but it does fulfill them, which is why it's such a successful language even if it's not suitable for a lot of projects that you, myself or the rest of HN visitors may be interested in. But, on top of that, Java actually tries to incorporate functionality that has been successfully proven in different, and more innovative, lenguages (at an admittedly slow pace). Conservative, yes; out of date, I don't think so. I'm not really fond of Java, and if I had to choose, I think there's probably no project for which I'd take it instead of some other language; however, its virtues are there.
- lutusp 13y ago> I know that Java gets a lot of hate, here and in a lot of places, and I won't deny that a lot of it is indeed very well deserved, but it's far from being a "legacy" language. No, not yet, and I understand that you've edited your reply. I'm only saying that over time Java has more and more properties that are (a) out of date and (b) impractical to change because of legacy considerations. The last time the Java developers made a major, code-invalidating change was when they decided that their event processing method needed to be replaced. It was a beneficial change, but a painful transition including a lot of "deprecated and to be removed" notifications and rewriting of existing code. Since that time, no further major changes have been made that would invalidate existing code, which is as it should be, but this means Java inevitably becomes more and more out-of-date as time passes. I emphasize that I write a lot of Java -- most of my best-known current programs are in Java, just because it will run on most platforms without any fuss. > ... it's far from being a "legacy" language. Like growing old, this doesn't happen all at once. :)
- deleted 13y ago[deleted]