只需使用
object.getClass()-它会返回用于实现接口的运行时类:
public class Test { public interface MyInterface { } static class AClass implements MyInterface { } public static void main(String[] args) { MyInterface object = new AClass(); System.out.println(object.getClass()); }}


