Java Design Pattern
Introduction to Java 10
Introduction to Java 11
Introduction to Java 12

Interface in java 8

Java 8(JDK 1.8 version) introduces a new concept of default method and static method implementation in interface. We can define method inside interface using the keyword default and static.

Java interface default method:

To define a default method in java interface, we use “default” keyword with the method signature.

For example,
package test;
interface A{
	default void show()
	{
		System.out.println("Silan Software");
	}
}
class B implements A
{
}
class InterfaceExample 
{
	public static void main(String[] args)
	{ 
		B  obj=new B();
		obj.show();
	}
}
Output

Silan Software



Java interface static method:

package test;
interface I{
	static void show()
	{
		System.out.println( "Silan Software");
	}
}
class InterfaceExample1
{
	public static void main(String[] args)
	{
		A.show();
	}
}
Output

Silan Software

About the Author



Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.


We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc






 PreviousNext