Monday, May 14, 2018

Technical Tip #04 - Technical Tip of the day....by JavaExpertHelp – www.JavaByKiran.com


T4: Knowledge Tip Of The Day.......
The three key characteristics of Object are
• State
• Behavior
• Identity
State:
• Instance variables value is called object state.
• An object state will be changed if instance variables value is changed.
Behavior:
• Behavior of an object is defined by instance methods.
• Behavior of an object is depends on the messages passed to it.
• So an object behavior depends on the instance methods.
Identity:
• Identity is the hashcode of an object, it is a 32 bit integer number created randomly and assigned to an object by default by JVM.
• Developer can also generate hashcode of an object based on the state of that object by overriding hashcode() method of java.lang.Object class.
• Then if state is changed , automatically hashcode will be changed.

No comments:

Post a Comment