Trying to interpret error message...

Can anyone help me make some sence of this message:

StorageBusiness.java:49: cannot find symbol

symbol : method add(java.lang.Object)

location: class java.util.ArrayList<Customer>

return getCustomer().add(inCustomer);

^__

It's obviously expecting something other than what I have.

Thank you

[346 byte] By [Student_20a] at [2007-10-3 4:09:06]
# 1
It seems you are calling add method on getCustomer() which probablyreturns and instance of Customer, and the Customer classdoes not have the void add(Object o) method in it.Pravin
PMJaina at 2007-7-14 22:09:03 > top of Java-index,Java Essentials,New To Java...
# 2

I thought add.() was a defined method already and you don't need it in a particular class. Here's the code it refers to:

// This method adds a customer ...

public boolean addCustomer(Object inCustomer)

{

if (inCustomer instanceof Customer)

return getCustomer().add(inCustomer);

else

return false;

}

So would I have to define add(Object o) in Customer as you suggest.

Student_20a at 2007-7-14 22:09:03 > top of Java-index,Java Essentials,New To Java...
# 3

public boolean addCustomer(Object inCustomer)

{

if (inCustomer instanceof Customer)

return getCustomer().add((Customer)inCustomer);

else

return false;

}

BIJ001a at 2007-7-14 22:09:03 > top of Java-index,Java Essentials,New To Java...
# 4

of course ....you need to add . Other thing is from your code , it seems that you have deined an arraylist of customers. if you want to add it ot the arraylist then , you can add it to Arraylist directly because add is pre-defiend method of ArrayList . But in that case you should add object to List not to the customer oject. For example if you ahve

ArrayList<Customer> a1=new ArrayList();

then you can a1.add(Obj); directly if Obj is of type Customer. I hope you need this kind of code

balaji31a at 2007-7-14 22:09:03 > top of Java-index,Java Essentials,New To Java...
# 5
Perfect - all working. Thanks for your help.
Student_20a at 2007-7-14 22:09:03 > top of Java-index,Java Essentials,New To Java...