为什么子类中的super.getClass()返回子类名称 [英] why super.getClass() in a subclass returns subclass name

查看:41
本文介绍了为什么子类中的super.getClass()返回子类名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个子类中,当我尝试查找超类的名称时,我尝试了super.getClass(),但它仅返回了子类的名称.为什么?

I am inside a subclass and when I am trying to find the name of super class, I tried super.getClass() , but it is returning me the name of the subclass only. Why?

推荐答案

getClass().getSuperclass()应该可以.

这篇关于为什么子类中的super.getClass()返回子类名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆