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 分别祝福语简短搞笑英文
18 生日广州男生祝福语简短