Java.io.ObjectStreamClass getSerialVersionUID() 方法


Java.io.ObjectStreamClass getSerialVersionUID() 方法

package com.codingdict;



import java.io.*;

import java.util.Calendar;



public class ObjectStreamClassDemo {



   public static void main(String[] args) {



      // create a new object stream class for Integers

      ObjectStreamClass osc = ObjectStreamClass.lookup(Integer.class);



      // get the serial for Integers

      System.out.println("" + osc.getSerialVersionUID());



      // create a new object stream class for Calendar

      ObjectStreamClass osc2 = ObjectStreamClass.lookup(Calendar.class);



      // get the serial for Calendar

      System.out.println("" + osc2.getSerialVersionUID());

   }

}