I'm very new to Java, and I would like your inputs.
So, I have an array:
String[] names = {"Anna", "Jo"};
String[] newNames = {"Bob", "Sue", "Jane"};
int totalLength = names.length + newNames.length;
String[] allNames = new String[totalLength];
And I am combining them through:
for (int i = 0; i < names.length; i++) {
allNames[i] = names[i];
}
for (int i = 0; i < newNames.length; i++}
allNames[i + names.length] = newNames[i];
}
My question is how do I set the allNames array into the original names array? Like, names would be "Anna", "Jo", "Bob", "Sue", "Jane". I know that there are methods that can do this, but how would you do it manually?
names = allNames;?