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

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -