Trouble understanding Object State, Behavior, and Identity?

前端 未结 5 1195
面向向阳花
面向向阳花 2021-01-30 11:42

I have been instructed by my professor to introduce myself on a page as if I were an object, and that I must address three things:
1) Object State, 2) Behavior, and 3) Ident

5条回答
  •  春和景丽
    2021-01-30 11:56

    In the programming implementation of an object,

    its state is defined by its instance variables. Instance variables are private to the object. Unless explicitly made public or made available to other “friendly” classes, an object’s instance variables are inaccessible from outside the object.

    An object’s behavior is defined by its methods. Methods manipulate the instance variables to create new state; an object’s methods can also create new objects. Java white paper page:34

提交回复
热议问题