It's not a secret anymore!
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes self-referential definitions? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "self-referential definitions?" Watch "self-referential definitions?" New topic

self-referential definitions?

Jo Lee
Ranch Hand

Joined: Jun 26, 2001
Posts: 35
Could any body explain what is self-referential definitions really mean?
and how to use it?
Jessica Sant

Joined: Oct 17, 2001
Posts: 4313

Self-referential definition *I think* means a word who's definition includes the word itself.
Like ummmm "ubiquitousness - something that is ubiquitous".
So by that idea, I would thing a self-referential definition in Java would be an expression that uses the variable in its own definition ??
x = 3 * x;
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
The way that I've seen this term used is when referring to some sort of complex data structure of arbitrary size. You see this a lot in the JLS as there is much discussion of data structures. From the JLS, §8.4.1 Formal Parameters:

   FormalParameterList , FormalParameter

In this case, we're defining a FormalParameterList in terms of itself. This allows us to easily describe something of arbitrary length. I used google and also came up with this site that discusses the topic.
There may very well be other contexts for this term and it might be helpful if you could provide us with the context from which you found the term so we know how it is being used. Jess' answer could very well be more appropriate for your context than this one.
I hope that helps,
[ June 05, 2002: Message edited by: Corey McGlone ]

SCJP Tipline, etc.
Jo Lee
Ranch Hand

Joined: Jun 26, 2001
Posts: 35
the context is as following:
inside the class scope and block scopes, we can also declare instances of the class(---> self-referential definitions) and refer to any of the variables and mehtods without the need for a prefix
I agree. Here's the link:
subject: self-referential definitions?
It's not a secret anymore!