1 / 54
文档名称:

计算机专业论文译文.doc

格式:doc   大小:282KB   页数:54页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

计算机专业论文译文.doc

上传人:aihuichuanran1314 2022/5/10 文件大小:282 KB

下载得到文件列表

计算机专业论文译文.doc

文档介绍

文档介绍:专业译文
原文出处:
Passing & Returning Objects
By now you should be reasonably s h) {
("h inside f(): " + h);
}
public static void main(String[] args) {
PassReferences p = new PassReferences();
("p inside main(): " + p);
f(p);
(new String[] {
"%% p inside main\\(\\): PassReferences@[a-z0-9]+",
"%% h inside f\\(\\): PassReferences@[a-z0-9]+"
});
}
} ///:~
The method toString( ) is automatically invoked in the print statements, and PassReferences inherits directly from Object with no redefinition of toString( ). Thus, Object’s version of toString( ) is used, which prints out the class of the object followed by the address where that object is located (not the reference, but the actual object storage). The output looks like this:
p inside main(): ******@ad3ba4
h inside f(): ******@ad3ba4
You can see that both p and h refer to the same object. This is far more efficient than duplicating a new PassReferences object just so that you can send an argument to a method. But it brings up an important issue.
Aliasing
Aliasing means that more than one reference is tied to the same object, as in the preceding example. The problem with aliasing occurs when someone writes to that object. If the owners of the other references aren’t expecting that object to change, they’ll be surprised. This can be demonstrated with a simple example:
//: appendixa:
// Aliasing two references to one object.
import .*;
public class Alias1 {
private static Test monitor = new Test();
private int i;
public Alias1(int ii) { i = ii; }
public static void main(String[] args) {
Alias1 x = new Alias1(7);
Alias1 y = x; // Assign the reference
("x: " + );
("y: " + );
("Incrementing x");
++;
System.

最近更新

全科医学概论探究心理病理学和心理治疗方法 29页

全科医学教育与医疗健康服务的关系 29页

儿童斜视的诊断与治疗 23页

儿童医院进修工作思想汇报儿童肿瘤的分子生物.. 33页

儿保骨科护理进修报告小儿骨折的常见病理类型.. 29页

依法行医与职业道德的统一要求 25页

住院医师规范化培训年度人际关系总结 31页

中国历史文化知识竞赛100题及答案【有一套】 14页

县乡教师选调考试《教师职业道德》题库及答案.. 41页

县乡教师选调进城考试《教育心理学》题库及答.. 122页

职业教育法考试题库及精品答案 26页

超星尔雅学习通《形势与政策(2024春)》章节.. 24页

伍德灯在老年医学研究中的意义与前景展望 25页

伍德灯在寻找皮肤损伤害部位中的实用价值研究.. 26页

淬金方案介绍 7页

欧式家具研究报告 6页

杂耍的研究报告 7页

施工大干方案 7页

方案介绍好写吗 7页

动态心电图诊断标准 2页

人工智能在航空航天中的应用与安全保障培训 25页

人工智能全科医生应用人工智能技术的全科医生.. 25页

了解女性生理期对卵巢功能减退的影响 24页

护理就业能力展示PPT 28页

湘版美术七年级总复习资料 11页

2024年高中英语会考试题及答案 9页

文旅发展联盟大会暨提升建设推进会发言 3页

教师合唱团方案 3页

上海景格汽车仿真教学软件安装全步骤 36页

车位包销合同协议书 8页