Object and class relationship

first of all, I have a class called appointment that have get variable(such as Time, Date and STring)method in it, and I have a second class called ListArrayBased. Inside, I have a method that can return an Object.

so

Appointment abc =new Appointment(Time, Date, String)

is ok...

then

ListArrayBased def =new ListArrayBased()

def.insertobject(abc)

ok...here is the question...how can I get the variable/things inside the object

I can't go for...object.getTime() inside the ListArrayBased class to retrieve the Time variable inside the object...what can I do...

[686 byte] By [saipkjaia] at [2007-9-29 23:46:57]
# 1
You should post some code. Without knowing what ListArrayBased.insertobject() does, it is hard to say how to access the inserted object.
atmguya at 2007-7-16 4:13:44 > top of Java-index,Archived Forums,Portability & Platform Independence [Archive]...
# 2
An object of a given class does what the class was designed to do. If you don't know what that is, you need to read that class's documentation (API, javadoc).
JN_a at 2007-7-16 4:13:44 > top of Java-index,Archived Forums,Portability & Platform Independence [Archive]...
# 3

hi,

u can use get the object from the arraylist by using the getter methods and assign it to a Object pointer of the Class type by typecasting it and then use the object to do whatever u want with it,

u can use something like this

1. int index=def.lastIndexOf(<object>);

2. Appointment abc =(Appointment)def.get(index);

then

3.abc.getTime();

and if u know the index of the object in the arraylist u can skip line 1.

cheers,

hayath

hayatha at 2007-7-16 4:13:44 > top of Java-index,Archived Forums,Portability & Platform Independence [Archive]...
# 4
oops. ...sorry i did not see the ListArrayBased class , i mistook it for ArrayList , but even then if it works the same way as an ArrayList it should work,
hayatha at 2007-7-16 4:13:44 > top of Java-index,Archived Forums,Portability & Platform Independence [Archive]...