String array refuses to accept passed element through a method
i have a method:
public void updateUsers(String[] connectedUsers)
which takes a string array as the parameter. What i'm trying to do is through another class i'm trying to access the method client.updateUsers(client.name); name is a string variable i'm trying to pass that through the updateUsers method so that it updates the list whenever a new client is created with the clients name (string).
I keep getting a compilation error saying that updateUsers(java.lang.String[]) in Client cannot be applied to (java.lang.String).
Here's the exact line i tried:
client.updateUsers(client.name);
Also in the class that i'm trying to access the method (server) which is in client i tried
String[] sa = new String[15];
sa[0] = "test";
and it works?
I don't understand why it's not accepting a string. I tried client.updateUsers() i get a compilation error saying that it can't be applied to ()