![]() |
Object data overlapping.
I have this code that i'm using to test if my program works, but all the Account type objects are somehow getting the same data inserted.
Code:
Account acc1 = new Account();for all 3 of them, while it should print: AAA 1 2 3 4 5.0 6.0 CCC 0 0 0 0 0.0 0.0 BBB 0 0 0 0 0.0 0.0 The Account class works perfectly, and I know this because it got 10/10 on my previous project. |
Re: Object data overlapping.
Post the codes for insert() and setcode().
It is not possible to tell what was wrong from what u have posted. Post some more parts of the code!!! |
Re: Object data overlapping.
Hi.
Since I haven't seen your source code, it's a bit difficult to figure out what's going on. You seem to be a new Java programmer, so perhaps your class is working, but it contains static variables? See, static variables are shared by all instances of a class, which would explain why altering one class has an effect on the rest as well. Remove any static keywords you have in the declaration of your variables and see if that helps. |
| All times are GMT +5.5. The time now is 17:10. |