[英]Java equivalent of C#'s Type?
How do you get and check an object's type in Java, as you can using Type t = obj.GetType();
如何在Java中获取和检查对象的类型,因为您可以使用Type t = obj.GetType();
in C#? 在C#?
Try getClass()
. 试试getClass()
。 It returns the runtime class of the object. 它返回对象的运行时类。
.getClass()
..
Class clazz = obj.getClass();
Isn't it fair to actually answer Class<?>
? 实际回答Class<?>
是不公平的?
Returns: The Class object that represents the runtime class of this object. 返回:表示此对象的运行时类的Class对象。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.