java - Invoking a default method inside a static method of interface -
i need call default method inside interface's static method (two methods in same interface- 1 default , other 1 static). possible? if so, how can achieve this?
look @ code portion better understand question:
interface a{ default void callee(){ //do here } static void caller(){ //call callee() method anyhow } }
you need instance call non-static method.
static void caller() { new a(){}.callee(); }
it better avoid static non-static calls. suppose can extract part of callee
static method.
Comments
Post a Comment