Implementing default methods in interfaces

…Prior to Java SE 8, interfaces could contain abstract methods and constant…declarations, but you couldn't provide fully…implemented methods that would be inheritable.…I'm working in a project called DefaultMethods.…And in this application, I have an interface named PersonInterface.Java.…It has four abstract methods, in interfaces…all abstract methods are soon to be…public, so I haven't included the public…keyword and these are basic getters and setters.…

Then I've a class named Person and this…class has the setters and the getters implemented.…And a constructor method that makes it easy to instantiate the class.…And then I have a main class called use default method.…In this code, I'm filtering a list of people using a predicate object,…and then, in the static method, display people at lines 30 and 31.…I'm putting together a string named info and outputting it to the console.…So, I'm going to refactor this code using a new capability of Java…SE 8 that lets me add something called a default method to an interface.…

Resume Transcript Auto-Scroll

Author

Released

5/28/2014

Take a tour of the new features in Java SE 8, the platform designed to support faster and easier Java development. Learn about Project Lambda, a new syntax to support lambda expressions in Java code; the new Stream API for processing collections and managing parallel processing; the DateTime API for representing, managing and calculating date and time values; and Nashorn, a new engine to better support the use of JavaScript code with the Java Virtual Machine. Author David Gassner also covers some lesser-known features such as new methods for joining strings into lists.