Search:

Type: Posts; User: javapenguin

Search: Search took 0.11 seconds.

  1. Replies
    4
    Views
    1,566

    Re: variable not recognised

    Wait, you mean you have to do it this way:


    public boolean equals(Object obj)
    {
    if (obj instanceof Person)
    {
    if (getName().equals((Person) obj.getName()))
    return true;
    }
  2. Replies
    4
    Views
    1,566

    Re: variable not recognised

    It appears the OP is using the equals method of the String class.

    This should work.



    public boolean equals(String name2)
    {
    if (getName().equals(name2))
    return true;
Results 1 to 2 of 2