Topic: 初学者求知(对象的reference指什么)

  Print this page

1.初学者求知(对象的reference指什么) Copy to clipboard
Posted by: tulipsmile
Posted on: 2005-12-06 10:05

我是刚刚开始学习java,想请教高手们一个问题,java中总提到对象的reference,这个到底指的是什么?比如说,在逻辑运算符的应用中,说是比较两个对象的reference,而不是比较对象的内容。首先谢谢各位的回答了。


请尽量使用准确的文字描述作为标题

原來的标题:
初学者求知

2.Re:初学者求知 [Re: tulipsmile] Copy to clipboard
Posted by: shibin20011983
Posted on: 2005-12-06 10:29

reference应该是引用,
看这个网址 它是c++的引用,可能对你有帮助把
http://www.programfan.com/article/showarticle.asp?id=2715

3.Re:初学者求知 [Re: tulipsmile] Copy to clipboard
Posted by: Infinite
Posted on: 2005-12-06 17:14

相关文章,应该对你有所帮助:
http://www.javaresearch.org/article/showarticle.jsp?column=546&thread=23910

4.Re:初学者求知(对象的reference指什么) [Re: tulipsmile] Copy to clipboard
Posted by: ranchgirl
Posted on: 2005-12-07 02:26

In Java, reference is a typed named memory space which holds addrees of an Object of that type.

It is called reference in Java, but called pointer in C/C++.

The key differences between C/C++ with Java on pointer/reference are

1) You cannot put your hands on an Object without through its reference in Java. In C/C++, you can.
2) In C/C++, you can do arithmetic on pointers, but you cannot do arithmetic on references in Java.
3) In C/C++, you can dereference a pointer, you cannot dereference a reference in Java.
4)In Java, all object are put on the heap only. In C/C++, you can put an Objecty/struct onto the stack.
5) In C/C++, you can cast pointer to an totally defferent type without compiler errors. In Java, you cannot, Java is more strong typed language.
6) In C/C++, pointer can point to primitive types too. In Java, reference cannot reference a primitive type, unlees the wrapper class is used.
7) In C/C++, pointer can point to another pointer, in Java, reference cannot reference another reference.

Java is safer, C/C++ is more powerful.

5.Re:初学者求知(对象的reference指什么) [Re: tulipsmile] Copy to clipboard
Posted by: tulipsmile
Posted on: 2005-12-07 17:03

很快得到各位大侠的回答,很是感动!增加了我认真往下学习的信心!深深感谢!

6.Re:初学者求知(对象的reference指什么) [Re: tulipsmile] Copy to clipboard
Posted by: jljf_hh
Posted on: 2005-12-12 13:53

呵呵。


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923