Tuesday, 19 May 2015

Java Interface Default Methods. What?



In my last post I’ve presented both traits and mixins, with the promise of identifying the Java 8 Interface Default Methods. So, let’s get on it.

First of all, if you don’t know what I’m talking about, read my previous post -and please ignore the fact that it took me almost half a year to write this second part :)

A quick summary:
  • Mixins: Abstract subclasses. You can call super from inside the mixin, and can define both methods and variables. Mixins automatically solves conflict by linearization (inserting the mixin in the method lookup chain from left to right).
  • Traits: Allow us to define behaviour outside the class, but don’t define state. The methods defined in the trait «have the same semantics» as the method defined in the class (Flattening property). It’s like they were copied into the class. You have to handle conflicts by yourself.

Now we can fully dive into Java Interface default methods, reading the post here :)

1 comment:

  1. awful piece of information, I had come to know about your blog from my friend vimal, mumbai,i have read atleast 3 posts of yours by now, and let me tell you, your blog gives the best and the most interesting information. This is just the kind of information that i had been looking for, i'm already your rss reader now and i would regularly watch out for the new posts, once again hats off to you! Thanks a million once again, RegardsGuidewire training in hyderabad

    ReplyDelete