Junilu Lacar wrote:Yes, you got it. Don't overthink it. They are both related but they're different perspectives.
Think of it like this: If you are a cashier at a store, abstraction is like you thinking about the customer paying for a purchase. That's the main behavior you care about. Implementation is whether the payment is done with cash, card, or check.
On the other hand, encapsulation is about the Customer knowing how much money they have in their bank account, how much cash they have in their wallet, or how much more they can charge before they reach their credit limit. To you, the cashier, that is information you are not privvy to, i.e. the information is hidden from you. Any attempt by you to obtain that information is inappropriate, i.e. you would be violating your customer's privacy or in ther words, you're breaking their encapsulation.
Does that make sense?
Junilu Lacar wrote:Please quote your sources so we know where you're getting your information.
Jesse Silverman wrote:
isam alie wrote:
Junilu Lacar wrote:
EDIT -- to be more explicit -- so, sure, it will still be anonymous, but that does NOT mean it is garbage collected after, as the method you passed your "one off" anonymous instance to can pretty easily squirrel it away somewhere for later enjoyment.
Why would it be anonymous if the method stored the object reference say in an ArrayList ? then the passed Circle Object will be accessible via an ArrayList indexed variable.
Junilu Lacar wrote:
however, once you dig down into the Circle.equals() method and follow the path the reference takes, it will no longer be anonymous because the object reference will be assigned to a parameter which of course has a name.
Jesse Silverman wrote:
I suspect this is a case of a multi-lingual author borrowing a phrase commonly used in one or more other languages and applying it to Java.
Junilu Lacar wrote:As far as I can tell, the Java Tutorials and the Java Language Specification only reference "anonymous classes"—with a quick Google search, I don't see any links to trusted Java reference materials that refer to "anonymous object."
@OP: please cite your sources where you found the term "anonymous object."
Campbell Ritchie wrote:Are we confusing anonyous classes and anonymous objects, the latter being a poor term which should never have been coined?
Campbell Ritchie wrote:Please explain what the algorithm is. You have so‑called arrow head code in lines 28‑49. That sort of code would need an explanation about how it works.