I'm working with an array list class called PersonList and it uses attributes from a normal class called Person.
I would like to make this method PrintPerson inside the PersonList class that should search for a specific Person given the ID as parameter to the method. the method should print all info of the Person if found, otherwise a message saying id is not valid.
I solved it like this:
public void PrintPerson(int id)
{
System.out.println("Enter ID of the person ");
id = Stdin.readInteger();
//search the ID if it is in the List
int i=0;
while
((i<next)&&(!(list.getID().equals(id))))
i++;
//if found
if (i<next)
{
list[i].OutputWindow();}//display the object ouput of this ID
else{
System.out.println("The following ID: " id "is not valid!");
}//end if
}// end of method
my problem is with this code:
((i<next)&&(!(list.getID().equals(id))))
I get this error "int cannot be dereferenced"
what should I do? help me please
-- Matt