Thanks Steve and Rob for the immediate reply.
Let me explain the problem more clearly.
I have class "class1" as follows,
public class class1{
static int i;
public static void main(
String args[]){
for(;;)
{
i++;
System.out.println("in class1: value of i is"+i);
}
}
}
I have class "class2" as follows,
public class class2{
public static void main(String args[]){
for(int j=0;j<10;j++)
System.out.println("in class2: value of i is"+class1.i);
}
}
Now I open Command prompt, and run class1.
Next I open another command prompt and run class2.
the value of i in class1 changes but the output of class2 is always zero.
There is no concept of threads used in this question.
Can you help me with this?
Chandana.