String array refuses to accept passed element through a method


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: String array refuses to accept passed element through a method

Threaded View

  1. #1
    Join Date
    Mar 2005
    Posts
    2

    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 ()
    Last edited by Emus; 03-26-2005 at 08:34 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center