I would like to set the items in an array of Strings in the parameter of a method.
So if I have an array, public String[] messages;
Then I have a method,
public void setMessages(),
I want to be able to use the parameters to set the items in the array, like this:
public void setMessages(String[] messages) {
this.messages = messages;
}
setMessages("Message 1", "Message 2", "Message 3");
And then the array has those three strings in it. How could I do something like this, because that obviously doesn't work?