Index:
[thread]
[date]
[subject]
[author]
From: Jason Grosland <jcg3@cs.duke.edu>
To :
Date: Thu, 1 Apr 1999 14:59:44 -0500
pointers v. references
a quick note worth mentioning:
there are no pointers in java. everything except for int, char, bool,
etc. are references, not pointers.
semantically the difference is that you can manipulate pointers (pointer
arithmetic), but references are only used to refer to an object.
'this' is a reference to a class's own instance. it can be useful to do
something like the following:
public class foo {
foo() {
this("Default name");
}
foo(String name) {
this(name, 0,0,0);
}
foo(String name, int x, int y, int z) {
// do your real constructor work here.
}
}
which is nice because it allows you to overload constructors without
needing to repeat code.
...jason
- By all means, think outside of the box. -
- Just put everything back when you're done. -
Index:
[thread]
[date]
[subject]
[author]