Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

"int cannot be dereferenced" error.. help me please

807600Oct 10 2007 — edited Oct 10 2007
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 7 2007
Added on Oct 10 2007
4 comments
193 views