arrays - How to convert the a java type to java string []? -


i want ask java string[] question. in java, if variable convents another, can add (string), (int), (double),... before variable in left hand side. however, there (string[]) in java want convent variable (string[]).

yes, there (string[]) cast array of string.

but able cast string array, must have array of super type of string or super type of array (only object, serializable , cloneable).

so these casts work :

string[] sarray = null; object[] oarray = null; serializable[] serarray = null; comparable[] comparray = null; charsequence[] charseqarray = null; object object = null; serializable serializable = null; cloneable cloneable = null;  sarray = (string[]) oarray; sarray = (string[]) serarray; sarray = (string[]) comparray; sarray = (string[]) charseqarray; sarray = (string[]) object; sarray = (string[]) serializable; sarray = (string[]) cloneable; 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -