Java.io.ObjectStreamClass.lookupAny() 方法


Java.io.ObjectStreamClass.lookupAny() 方法

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.lookupAny(Integer.class);



      // get the name for Integers

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



      // create a new object stream class for Thread, which is not serializable

      ObjectStreamClass osc2 = ObjectStreamClass.lookupAny(Thread.class);



      // get the name for Calendar

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

   }

}