1 Reply Latest reply on Oct 18, 2010 7:46 AM by EJP

    Why static transient variable is get serialized

    805951
      If we declared a variable as

      transient String x = "abc"

      then it will suppress serialization
      but if declare as

      transient static String x = "abc"

      then this variable get serialized .
      Please explain this.
      Tia.
        • 1. Re: Why static transient variable is get serialized
          EJP
          then this variable get serialized .
          No it doesn't. If you change it dynamically to "xyz" and then serialize the object, it will still be "abc" at the receiver. Ergo no serialization is taking place. What is happening is that the class is loaded in its initial state when loaded on the receiving end.
          1 person found this helpful