super.getClass().getName()
来源:互联网 发布:java package 编译 编辑:程序博客网 时间:2024/05/16 19:31
public static void main(String[] args) {
new StringTest().show();
}
private void show(){
System.out.println(super.getClass().getName());
}
由以上代码组成的测试案例:
1、预计运行结果:Date
2、实际运行结果:StringTest
3、运行结果分析:
/**
* Returns the runtime class of this {@code Object}. The returned
* {@code Class} object is the object that is locked by {@code
* static synchronized} methods of the represented class.
*
* <p><b>The actual result type is {@code Class<? extends |X|>}
* where {@code |X|} is the erasure of the static type of the
* expression on which {@code getClass} is called.</b> For
* example, no cast is required in this code fragment:</p>
*
* <p>
* {@code Number n = 0; }<br>
* {@code Class<? extends Number> c = n.getClass(); }
* </p>
*
* @return The {@code Class} object that represents the runtime
* class of this object.
* @see <a href="http://java.sun.com/docs/books/jls/">The Java
* Language Specification, Third Edition (15.8.2 Class
* Literals)</a>
*/
public final native Class<?> getClass();
以上是Object类中getClass()方法及注释,由于getClass方法被定义为final,所以该方法不可继承(重写)。
由Object类的getClass()方法注释可知,getClass()方法返回的是运行时主调类的类名。
- 关于super.getClass().getName()
- 关于super.getClass().getName()
- 关于super.getClass().getName()
- super.getClass().getName()
- super.getClass().getName()
- super.getClass().getName()
- 继承中的super.getclass().getName()
- java super.getClass().getName()得到了什么
- super.getclass().getname()返回调用的是什么
- 关于this.getClass().getSuperClass().getName()与super.getClass()
- getClass().getName()
- super.getClass().getName()方法调用返回的是谁?
- super.getClass().getName() 返回父类还是当前类
- getClass().getName()解析
- getClass().getName()再学习
- java getClass, getName
- super.getClass()
- super.getClass()
- RecyclerView GridLayoutManager 布局 无法居中(偏左)
- UVa难度表
- Redis内部数据结构实现解析
- Android中基于Http协议的网络通信的两种方法Get和Post
- POJ 3624 Charm Bracelet 0 1 背包
- super.getClass().getName()
- 5步安装vsftpd
- Android开发中Handler的经典总结
- 黑马程序员-java基础(五)-多线程
- aix6.1安装oracle12.1.0.2,dbca时候报错UnsatisfiedLinkError exception loading native library: njni12
- windows 环境下 ipython %edit 编辑器配置
- datagridview自动调整列宽
- async and await 操作实例
- 更改apatch端口为80, [warn] NameVirtualHost 10.254.1.65:80 has no VirtualHosts