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

about trasient and static variable  RSS feed

 
basitha smith
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if one variable is declared as static and transient what is its use?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The "static" descriptor identifies the variable as a class variable, meaning that there is only one copy of the variable for all instances of the class. The "transient" descriptor indicates that the contents of the variable will not be persisted if an instance of the class is serialized, or if it is persisted to a database through the Java Persistence API.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!