如何知道接口被那个实现类实例化

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/bestxianfeng163/article/details/84970001

public class son implements ParentInterface{

	@Override
	public void speak(String name) {
		// TODO Auto-generated method stub
		System.out.println("123453");
		
	}
	public static void main(String[] args) {
		ParentInterface parent=new son();
		System.out.println(parent.getClass());
	}

}
打印
    class com.java.test.son

猜你喜欢

转载自blog.csdn.net/bestxianfeng163/article/details/84970001