WhatistheappropriatedefinitionofthehashCodemethodinclassPerson?() A.returnsuper.hashCode();B.returnname.hashCode()+age*7;C.returnname.hashCode()+comment.hashCode()/2;D.returnname.hashCode()+comment.hashCode()/2-age*3;

WhatistheappropriatedefinitionofthehashCodemethodinclassPerson?()

A.returnsuper.hashCode();

B.returnname.hashCode()+age*7;

C.returnname.hashCode()+comment.hashCode()/2;

D.returnname.hashCode()+comment.hashCode()/2-age*3;


相关考题:

publicclassPerson{privateStringname,comment;privateintage;publicPerson(Stringn,inta,Stringc){name=n;age=a;comment=c;}publicbooleanequals(Objecto){if(!(oinstanceofPerson))returnfalse;Personp=(Person)o;returnage==p.agename.equals(p.name);}}WhatistheappropriatedefinitionofthehashCodemethodinclassPerson?()A.returnsuper.hashCode();B.returnname.hashCode()+age*7;C.returnname.hashCode()+comment.hashCode()/2;D.returnname.hashCode()+comment.hashCode()/2-age*3;

Given:WhatistheappropriatedefinitionofthehashCodemethodinclassPerson?() A.returnsuper.hashCode();B.returnname.hashCode()+age*7;C.returnname.hashCode()+comment.hashCode()/2;D.returnname.hashCode()+comment.hashCode()/2-age*3;