java - What does this new String[] and String.value() code mean? -


i doing android development , encountered this:

       string[] strarray = new string[]{            string.valueof(1)       }; 

why string created object ,

valueof(1) 

actually set here ?

this:

string[] strarray = new string[]{     // ... }; 

...creates string array , initializes entries in {...} part. in case, there's 1 entry.

why string created object , does

valueof(1);

as the documentation tell you, string.valueof(int) creates string representation of integer value pass in.

so code create array of string 1 entry, "1", in it. it's unclear why author have written string.valueof(1) rather "1".


Comments