The following code throws a NullPointerException.
import java.io.*;
public class NullFinalTest {
public static void main(String[] args) thr
A transient final field used as a lock is null
Here are few facts about the transient variable:
- Transient keyword when used on an instance variable, will prevent that instance variable to be serialized.
- On De-serialization, the transient variable get to their Default values.....
Eg:
null0false, etc.......So thats the reason you are getting a NullPointerException, when deserializing it...