开发者

Java equivalent of C#'s Type?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜