Java基础教程之对象引用
我们之前一直在使用“对象”这个概念,但没有探讨对象在内存中的具体存储方式。这方面的讨论将引出“对象引用”(objectreference)这一重要概念。
对象引用
我们沿用之前定义的Human类,并有一个Test类:
publicclassTest
{
publicstaticvoidmain(String[]args)
{
HumanaPerson=newHuman(160);
}
}
classHuman { /** *constructor */ publicHuman(inth) { this.height=h; }
/** *accessor */ publicintgetHeight() { returnthis.height; }
/** *mutator */ publicvoidgrowHeight(inth) { this.height=this.height+h; }
privateintheight; }
热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短