Trouble understanding Object State, Behavior, and Identity?
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. Object State,
Behavior, and Identity. However, I am still really confused as to how I
would go about doing something like this. (I have read about the three
attributes I must address, but I don't know how I would apply it to a
person). For example, I was told a dog would have States, such as name,
color, and breed; as well as Behaviors, such as walking, barking, or
wagging their tail. So would I do something similar to:
Student me = new Student();
System.out.println(me.getName()); //a state?
System.out.println(me.getCurrentActivity()); //A behavior? (if it were to
return watching TV or something)
System.out.println(me.get....()); //???
Or am I getting the completely wrong idea here?
No comments:
Post a Comment