Page 1 of 1
About Question enthuware.ocajp.i.v8.2.1448 :
Posted: Wed Nov 25, 2015 9:44 am
by prasanna_ls
Do objects have behavior? Objects only have a state, right? Objects don't have the methods within themselves as far as I understand. They only have instance variables. They pass "this" along with the parameters to the methods which are in.... the Class class? Or the Class Object? I'm really confused here

Re: About Question enthuware.ocajp.i.v8.2.1448 :
Posted: Wed Nov 25, 2015 9:50 am
by prasanna_ls
Also, it's valid to say Classes can be reused. But is it valid to say that objects can be reused? As mentioned in the explanation, it is very ambiguous. "One can certainly call methods on the same object again and again." But that is just normal use right? There isn't any reuse there. Maybe they're referring to the String intern pool? The String objects there can certainly be reused.
Re: About Question enthuware.ocajp.i.v8.2.1448 :
Posted: Wed Nov 25, 2015 9:52 am
by admin
prasanna_ls wrote:Do objects have behavior? Objects only have a state, right? Objects don't have the methods within themselves as far as I understand. They only have instance variables. They pass "this" along with the parameters to the methods which are in.... the Class class? Or the Class Object? I'm really confused here

Classes define the behavior but it is the objects that behave. For example, the Dog class may define a behavior named eat or bark. But it is an actual Dog object that will eat or bark.
HTH,
Paul.
Re: About Question enthuware.ocajp.i.v8.2.1448 :
Posted: Wed Nov 25, 2015 9:53 am
by admin
prasanna_ls wrote:Also, it's valid to say Classes can be reused. But is it valid to say that objects can be reused? As mentioned in the explanation, it is very ambiguous. "One can certainly call methods on the same object again and again." But that is just normal use right? There isn't any reuse there. Maybe they're referring to the String intern pool? The String objects there can certainly be reused.
Right. That is why this option is too vague and ambiguous.
Re: About Question enthuware.ocajp.i.v8.2.1448 :
Posted: Sun Dec 23, 2018 7:17 pm
by flex567
From the explanation:
This is not true because Java does have primitives as well (byte, short, char, int, long, float, double, boolean), which are not Objects.
Interfaces are also not objects.