- Static variables are class variables.
- Static variables can be serialized.
- static modifier applies to static variables.
static int testVariable;
. . .
}
Transient variables
- Transient variables are member or instance variables of class.
- Transient variables can not be serialized.
- transient modifier applies to transient variables.
transient int testVariable;
. . .
}
yes.....got it!
ReplyDeleteI have a question regarding volatile modifier.
I heard it can b used in timer applications,but
even after reading much about it i am not able to understand correctly.
Can u please explain with appropriate example..
Hi Kapish,
ReplyDeleteThe volatile is not necessary to used only in timer applications. The below post may help you to understand more about volatile modifiers.
http://sharad-java-j2ee-interview-questions.blogspot.com/2010/05/volatile-modifiers-in-java.html
If you still have problem please let me know.
Have a great day :)