The thing is that I have been asked a question about arrays and setters. If I create an array inside a class and from the main class I want to call the setter method of that array, it doesn't work as I would expect:
clase1.setNombresArray("Carlos Mendoza", "Julio Maldonado", "Enrique Pajares", "Diego Blanco", "María del Rosal");
And my setter is as follows:
public void setNombresArray(String[] nombres) {
this.nombres = nombres;
}
So how can I do so that from the main class I can enter 5 names to the array of length 5? Should I make a loop in which the names are passed one by one?
Thank you