This is related to Java 8 interfaces. I have an interface which has only a default method. I can create an anonymous instance of this interface.
public interface Itest{
    default String get(){
            return "My name is ITest";
    }
}
public class A{
     Itest itest = new Itest(){};
}
I want to create an Utility function to which provided an Interface, returns the anonymous class. Something like the following
class MyUtil{
    public static <T> T get(Class<T> interface){
        // returns the anonymous class for the interface argument
        // Something like return new interface(){};
    }
}
public class A{
     Itest itest = MyUtil.get(Itest.class);
}
Some one help me if its possible and how to achieve it inside the MyUtil.get() function?
Usecase: I have few such interfaces(with default methods). Now if there is no implementation class available for these interfaces in a setup, I want to create anonymous class instance so that can call the default methods. This will save the effort to create the implementation classes when i just need these default methods itself.
 
     
     
    