I don't think it is superfluous, consider the following situation. [Read the topic wrong!!!]
1) Serialize an Object
2) Do Some operations using the transient variable (increment or pass it to some method..)
3) Deserialize the Object
4) Try accessing the transient variable , it will be initialized to the default value.
But if you have marked the variable static, then it will not be initialized because the static does not belong to a particular instance.
I cranked some code to check this out.
Joined: Sep 21, 2008
Oops sorry , I read your question wrong the other way round!! but never mind the code can be a mock quiz question!
It is superfluous! [Ignore my earlier post's verbage !!]
Joined: Dec 16, 2008
No problem Kavita. You can start your own mock exam product with this example!
subject: Why are transient static variables allowed?