开发者

How to verify if variable type is an array in Java languge

开发者 https://www.devze.com 2023-01-12 06:52 出处:网络
I\'m new to java. Please let me know how to veri开发者_JS百科fy if variable type is an array in Java languge.With any object, you can do this:

I'm new to java. Please let me know how to veri开发者_JS百科fy if variable type is an array in Java languge.


With any object, you can do this:

Class clazz = myObject.getClass();

if( clazz.isArray() ) {
    // ... array specific stuff.
}


Any type that is suffixed by [] is an array type.

0

精彩评论

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