开发者

Java equivalent of C#'s Type?

开发者 https://www.devze.com 2023-01-06 03:41 出处:网络
How do you get and check an object\'s type in Java, as you can using 开发者_Python百科Type t = obj.GetType(); in C#?Try getClass(). It returns the runtime class of the object.Class clazz = obj.getClas

How do you get and check an object's type in Java, as you can using 开发者_Python百科Type t = obj.GetType(); in C#?


Try getClass(). It returns the runtime class of the object.


Class clazz = obj.getClass();


.getClass()..


Isn't it fair to actually answer Class<?>?

Returns: The Class object that represents the runtime class of this object.

0

精彩评论

暂无评论...
验证码 换一张
取 消