Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2003
    Location
    MN
    Posts
    5

    Unanswered: newbie List help needed

    I have a business class that determins if a user is valid, but I would like it to return as a List. This will allow me to send over a few items.

    A) Is this how I would set this up in my business class(see attempt below):
    public class UserData {
    public List isUserValid (String username, String password)
    throws Exception {
    //build list here
    }
    }

    B) how do I set a new List equal to the return value of the above method(see failing attempt below):

    //Fails
    List validUser = new ArrayList();
    validUser.addAll(UserData.isUserValid(username, password));

    //Fails
    List validUser = (List)UserData.isUserValid(username, password);


    The compiler errors out stating:
    "non-static method isUserValid(java.lang.String,java.lang.String) cannot be referenced from a static context"


    Any help would be appreciated.

    Thanks

  2. #2
    Join Date
    Aug 2003
    Location
    MN
    Posts
    5

    Re: newbie List help needed

    nevermind... I figured it out

    Originally posted by c_monty
    I have a business class that determins if a user is valid, but I would like it to return as a List. This will allow me to send over a few items.

    A) Is this how I would set this up in my business class(see attempt below):
    public class UserData {
    public List isUserValid (String username, String password)
    throws Exception {
    //build list here
    }
    }

    B) how do I set a new List equal to the return value of the above method(see failing attempt below):

    //Fails
    List validUser = new ArrayList();
    validUser.addAll(UserData.isUserValid(username, password));

    //Fails
    List validUser = (List)UserData.isUserValid(username, password);


    The compiler errors out stating:
    "non-static method isUserValid(java.lang.String,java.lang.String) cannot be referenced from a static context"


    Any help would be appreciated.

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •