Win a copy of Murach's Java Programming this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Invariants in Java  RSS feed

 
Chivid Ram
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone  explain me invariant with an easy example ?
 
Stephan van Hulst
Saloon Keeper
Posts: 7469
133
  • Likes 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Invariants are just properties of an object that hold under ALL circumstances. For instance:

Invariants can be any property you think of. For instance, an invariant for a game of Tic Tac Toe could be that the board is always square.
 
I will suppress my every urge. But not this shameless plug:
Thoughts on deprecation in Java
https://coderanch.com/t/683016/java/Deprecation-Java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!