Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Object references  RSS feed

 
Maureen Charlton
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
* Object
* Cloneable
* Serializable

My understanding is the above three are object references.

Could someone give me an example of what these are/do/mean?
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An "object reference" is basically a "handle" on a particular instance of some class. It is essentially a memory address, indicating where exactly that object is stored.

As for Object, Cloneable, and Serializable...

Object (class):
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html

Cloneable (interface):
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Cloneable.html

Serializable (interface):
http://java.sun.com/j2se/1.5.0/docs/api/java/io/Serializable.html
 
Maureen Charlton
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marc,

Excellent reply - especially the links!

Many thanks!!
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The links given above come from Sun's Java API documentation. Learning how to navigate these is an essential skill for any Java programmer, imo. I strongly encourage you to use the link given here to find the docs for the version of Java that you are using.

Layne
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!