javaspringtutorials-blog
javaspringtutorials-blog
Java Spring Tutorials
1 post
Don't wanna be here? Send us removal request.
javaspringtutorials-blog ยท 4 years ago
Text
JAVA 8 Default Methods
Java 8 allows you to add non-abstract methods into interfaces and these methods must be declared as default.
Below is an example of the default method in the interface.
public interface Test{
default void copy(){
System.out.println("I am copy");
}
}
public class Utility implements Test{
public static void main(String[] args){
Utility utility = new Utility ();
utility .copy();
}
}
Output: I am copy
For more detail visit - javaspringtutorials
2 notes ยท View notes