I want to ask a Java String[] question. In the java, if a variable convents to another, it can add the (String), (int), (double),… before the variable in the left hand side. However, is there something like (String[]) in Java as I want to convent the variable into (String[]).
I want to ask a Java String[] question. In the java, if a variable
Share
Yes, there is
(String[])which will cast into an array of String.But to be able to cast into a String array, you must have an array of a super type of
Stringor a super type of array (onlyObject,SerializableandCloneable).So only these casts will work :