Recently in an interview I was asked a question:
There are 100 properties in a Java class and I should be able to serialize only 2 of the properties. How is this possible?
Marking all the 98 properties was not the answer as it is not efficient. My answer was to carve out those properties into a separate class and make it serializable.
But I was told that, I will not be allowed to modify the structure of the class. Well, I tried to find an answer in online forums, but in vain.