Computing.Net > Forums > Programming > Object assignment in Java

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Object assignment in Java

Reply to Message Icon

Name: cunaz
Date: August 14, 2004 at 11:22:34 Pacific
OS: Windows XP - Pro
CPU/Ram: 2400 Mhz/256 Mb RAM
Comment:

Hi guys, I've a question for you!
I have an object of this kind:
PosCoord(char amm, String moves, int[] coord), where coord is an array of coordinates. I created an array "scorpo" of PosCoord, length 29:
PosCoord [] scorpo = new PosCoord[29];
Now I write:
int [] c = {0,0,0};
for(int i=0;i<scorpo.length;i++)
{ scorpo[i] = new PosCoord(Protein.letterSeq[i], "NO", c);
}
where letterSeq is an array of char.
If I do:
scorpo[1].coord[1]=scorpo[0].coord[1]+1;
and I try to show the coords of scorpo[0] and scorpo[1] now I see that they are the same, while I want scorpo[1].coord[1] to be 1 and scorpo[0].coord[1] to be 0.
Why does it happen??And how can I solve the problem!!??Help me please!!
Thanx!!
-Mauri-



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


VB Tutorial Cannot Update datbase



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Object assignment in Java

Object Serialization in Java www.computing.net/answers/programming/object-serialization-in-java/10261.html

Object array in Java www.computing.net/answers/programming/object-array-in-java/11087.html

some questions in Java www.computing.net/answers/programming/some-questions-in-java/9834.html