Java.io.ObjectStreamClass.forClass() 方法


Java.io.ObjectStreamClass.forClass() 方法

package com.codingdict;



import java.io.*;



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 Class instance for osc

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



      // create a new object stream class for Strings

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



      // get the Class instance for osc

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



   }

}