-1
$\begingroup$

Say there is a class called Person. Then in the following expression :

Person human = new Person()

Which is the "reference" and which is the "object"?

human should be the reference since it's not an actual object, it simply points to an object. On the other side, new Person() truly is the actual object. I've seen these terms used vice versa and I was wondering what's the actual naming?

$\endgroup$
  • $\begingroup$ Welcome to COMPUTER SCIENCE @SE. What does The Java Language Specification specify for the new operator? Does it specify the "object" to appear in a reference assignment? (consider tagging terminology) $\endgroup$ – greybeard Oct 9 at 5:11
  • $\begingroup$ Hi, I believe this is a programming question. Programming questions should be asked on stackoverflow.com, not on cs.stackexchange.com. $\endgroup$ – Zachary Vance Oct 12 at 4:41
-2
$\begingroup$

Person is a class and human is an object the most important key point about object is it points towards feilds and methods but here you will see in braces you have passed nothing means class Person have no parametrized constructor but have a default one

Thanks bro if you will find any difficulty while doing java i am here for your help so free to ask👍

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.