Java.io.ObjectStreamField.isUnshared()方法

package com.yiibai;import java.io.*;import java.util.Calendar;public class ObjectStreamFieldDemo {public static void main(String[] args) {

编程学习网为您整理以下代码实例,主要实现:Java.io.ObjectStreamField.isUnshared()方法,希望可以帮到各位朋友。

package com.yiibai;

import java.io.*;
import java.util.Calendar;

public class ObjectStreamFIEldDemo {

   public static voID main(String[] args) {

      // create a new object stream class for Integers
      ObjectStreamClass osc = ObjectStreamClass.lookup(Integer.class);

      // get the fIEld value from Integer class
      ObjectStreamFIEld fIEld = osc.getFIEld("value");

      // check if fIEld is unshared
      System.out.println("" + fIEld.isUnshared());

      // create a new object stream class for calendar
      ObjectStreamClass osc2 = ObjectStreamClass.lookup(Calendar.class);

      // get the fIEld value from Integer class
      ObjectStreamFIEld fIEld2 = osc2.getFIEld("isSet");

      // check if fIEld is unshared
      System.out.println("" + fIEld2.isUnshared());

   }
}

本文标题为:Java.io.ObjectStreamField.isUnshared()方法