class Test {
static int p;
Test(int x) {
p=x;
}
}
class Mtest
{
public static void main(String args[])
{
Test c[] = new Test [100];
for(int i=0; i<5; i++) {
c[i]=new Test(i);
}
for (int i=0; i<5;i++) {
System.out.println(c[i].p);
}
}
OUTPUT: 4 4 4 4 4
What kind of sorcery is this? shouldnt it give me 0,1,2,3,4??
statickeyword from declaration ofp, and see the magic.