Why does Java have transient fields?
As per google transient meaning == lasting only for a short time; impermanent.
Now if you want to make anything transient in java use transient keyword.
Q: where to use transient?
A: Generally in java we can save data to files by acquiring them in variables and writing those variables to files, this process is known as Serialization. Now if we want to avoid variable data to be written to file, we would make that variable as transient.
transient int result=10;
Note: transient variables cannot be local.