I am having a problem with calling a default method from an interface. Here is my code:
Interface:
public interface Pozdrav {
public static void stat(){
System.out.println("Ja sam staticni metod");
}
default void osn(){
System.out.println("Ja sam osnovni metod");
}
}
Main class:
public class KonkretniPozdrav implements Pozdrav{
public static void main(String[] args) {
Pozdrav.stat();
}
}
Now, I need to call the default method Pozdrav.osn();
but when I do that, I receive this error:
Error:(8, 16) java: non-static method osn() cannot be referenced from a static context.
How do I call this default method?