Re: What is the difference between a name of an object and a reference
to an object?
tenxian wrote:
Can anyone give me a clarification about both?
From the JLS -
"Names are used to refer to entities declared in a program. A declared
entity (?6.1) is a package, class type (normal or enum), interface type
(normal or annotation type), member (class, interface, field, or method)
of a reference type, type parameter (of a class, interface, method or
constructor) (?4.4), parameter (to a method, constructor, or exception
handler), or local variable.
Names in programs are either simple, consisting of a single identifier,
or qualified, consisting of a sequence of identifiers separated by "."
tokens (?6.2).
Every declaration that introduces a name has a scope (?6.3), which is
the part of the program text within which the declared entity can be
referred to by a simple name.
Packages and reference types (that is, class types, interface types, and
array types) have members (?6.4). A member can be referred to using a
qualified name N.x, where N is a simple or qualified name and x is an
identifier. If N names a package, then x is a member of that package,
which is either a class or interface type or a subpackage. If N names a
reference type or a variable of a reference type, then x names a member
of that type, which is either a class, an interface, a field, or a method."
and for references
"There are three kinds of reference types: class types (?8), interface
types (?9), and array types (?10). Reference types may be parameterized
(?4.5) with type arguments (?4.4)." ...
"The reference values (often just references) are pointers to these
objects, and a special null reference, which refers to no object."
--
Knute Johnson
email s/nospam/linux/
--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDem