Contrary to what it may sound like, a null object is not simply a variable such as Object myVar = null – it’s an actual object instance, but it represents an “empty” value.
What an empty or null value means depends much on the context. For example, if you think of a website which allows users to register accounts, an empty value could be an anonymous user without an account. In a case like this, you could have a null user object, which represents a user who has not logged in.
1 comment:
Contrary to what it may sound like, a null object is not simply a variable such as Object myVar = null – it’s an actual object instance, but it represents an “empty” value.
What an empty or null value means depends much on the context. For example, if you think of a website which allows users to register accounts, an empty value could be an anonymous user without an account. In a case like this, you could have a null user object, which represents a user who has not logged in.
Post a Comment