New to object oriented Programming...

Hi,

Could someone pls. help me understand what is this return type...

I came across this line of code as an example when I was reading about the return types of methods...

Acells = new ArrayList(columns);

public MatrixCell getColumn(int x)

{

return (MatrixCell)Acells.get(x);

}

Is it returning an object of MatrixCell?

Now, MatrixCell has static final variables and some get and set methods.

So, by returning this as a type .... what is being accomplished?

I will really appreciate help in this matter.

[575 byte] By [mjasa] at [2007-11-26 20:38:43]
# 1

public MatrixCell getColumn(int x)

{

return (MatrixCell)Acells.get(x);

}

this method ofcourse returns a MatrixCell object reference;

can you give full code? and usse code tag while posting codes.

tanmoy_rajgurua at 2007-7-10 1:55:46 > top of Java-index,Java Essentials,New To Java...
# 2

I believe MatrixCell is an object that consists of some attributes. All the program(you provided) does is retrieve an instance of the object(actually the reference) from an ArrayList with the index provided. It's like you retrieve a letter in an array of mailbox, then do whatever you want with it.

You seems like not really clear about concept of an object, good luck finding out more about that =)

Icycoola at 2007-7-10 1:55:46 > top of Java-index,Java Essentials,New To Java...
# 3
Thanks for your help!! Guys. Hopefully next time I will ask a better question.
mjasa at 2007-7-10 1:55:46 > top of Java-index,Java Essentials,New To Java...