Which is valid syntax to declare and initialize a string variable?
Answers
Answered by
2
You can do the following during declaration:
String names[] = {"Sarah","James","John"};
And if you want to do this somewhere after declaration:
String names[];
names = new String[] {"Sarah","James","John"};
Similar questions