java newbie
I am writing a java program with arraylist
for (int i = 0; i < Width; i++) {
myRect.add(new MyRect(a,b,c,d,r,z));
z += 1;
}
for (int i = 0; i < myRect.size(); i++) {
MyRect m = (MyRect)myRect.get(i);
System.out.println(m);
}
what i am trying to do is creating a myRect class object, all of them have the same a,b,c,d,r, except z, each myRect class is increment by 1, however, when i will to println those values out
i got all my z's to be a same number. doesn't anyone know why and how to tackle it. thanks
|