Can HashMap be serialized in 1.7, used in 1.6?

I thought this would cause an error indicating a minor version number; But this is not so. And it works correctly. Can anyone point out why this works?

I created hashMap in an application running on java 1.7, serializing it and sending it to the application using jdk 1.6. The receiving application was able to retrieve the content without any errors.

+4
source share
1 answer

The attribute is used here serialVersionUID.

In class HashMapand Java versions 6.0 and 7.0, serialVersionUIDit looks like this:

private static final long serialVersionUID = 362498820763181265L;

, , , , / Java, / .

, Java 8.0 UID HashMap, Java 5.0 ( 1.4), , / HashMap Java 1.4-5-6-7-8 .

+12

All Articles