Object data overlapping.- Need help with static variables.
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.
It prints out : BBB 1 2 3 4 5.0 6.0
Account acc1 = new Account();
Account acc2 = new Account();
Account acc3 = new Account();
acc1.insert("AAA", 1, 2, 3, 4, 5, 6);
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.
Also, I understand that the problem is probably caused by the use of static variables in the Account class. How do I fix this? Mind you, I can't really take off the static infront of those variables because the methods that use them are static too. Also, if I use static in front of my acc1,acc2,acc3 I just get a java.lang.NullPointerException.
Please help me :D