Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

hi  RSS feed

 
anita dhar
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My doubt is about the transient varaiables and what is the use of it
 
dhwani mathur
Ranch Hand
Posts: 621
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok!!!
By defination i can say transient is a variable which cannot be serialed.
Transient is useful when you either don't need the value on the other end or you can reconstruct it from other information.

An example would be a file handle or database connection. Such objects are only meaningful locally. In fact, you *have* to declare them transient in a Serializable class because they don't implement Serializable themselves. You can write code to re-initialize the handles on the "other side" with locally significant values, but you can't transport the objects directly.


Transient variables are used when we wanted to hide some information while transferring the data to some remote server.
e.g Password,CreditCardNo,CVV no.these info are very sensitive and cant be sent during transfer of data into n/w .
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!