java - How to find out the type of an array? -



java - How to find out the type of an array? -

suppose have method public static void amethod(t[] items). how find out if items of type string or int or double? used instanceof im not sure of.

public static void amethod(t[] items) { for(int = 0; < items.length; i++) { if(items[i] instanceof string) { } } }

generally class class has methods may help, example:

object ob = new bigdecimal("30"); system.out.println(ob.getclass().getcanonicalname());

result: java.math.bigdecimal

java

Comments

Popular posts from this blog

python - How to add an model instance to a django queryset? -

Using Android Volley to post an array to PHP -

angularjs - No 'Access-Control-Allow-Origin' error from local domain to public API -