Answers for "default method in java"

1

default method in java

public interface SomeInterface(){
	default void test(){
    	//this will be done when the method is called by default
    }
}
public class SomeInterfaceImpl implements SomeInterface{
	//has test method from SomeInterface, can be overwritten
}
public class SomeClass{
	public void test(){
    	//do something else
    }
}
public class SomeOtherClass extends SomeClass implements SomeInterface{
	//uses the test method from SomeClass
}
Posted by: Guest on April-16-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language