Java Reference
In-Depth Information
Ta b l e 3 . 1
Access Modifiers
Access Modifier
Meaning
var
The default access permission is script access, so without access
modifiers, a variable can be initialized, overridden, read, assigned,
or bound from within the script only.
def
The default access permission is script access; a definition can be
read from or bound to within the script only.
public var
Read and writable by anyone. Also, it can be initialized, overrid-
den, read, assigned, or bound from anywhere.
public def
This definition can be read anywhere. A definition cannot be
assigned, initialized (in an object literal), or overridden no matter
what the access permissions. It may be bound from anywhere.
public-read var
Readable by anyone, but only writable within the script.
public-init var
Can be initialized in object literals, but can only be updated by the
owning script. Only allowed for instance variables.
A variable accessible from the package. This variable can be ini-
tialized, overridden, read, assigned, or bound only from a class
within the same package.
package var
package def
Define a variable that is readable or bound only from classes
within the same package.
A variable accessible from the package or subclasses. This vari-
able can be initialized, overridden, read, assigned, or bound from
only a subclass or a class within the same package.
protected var
protected def
Define a variable that is readable or bound only from classes
within the same package or subclasses.
Readable and bound by anyone, but this variable can only be ini-
tialized, overridden, or assigned from only a subclass or a class
within the same package.
public-read protected var
public-init protected var
Can be initialized in object literals, read and bound by anyone, but
can only be overridden or assigned, from only a subclass or a
class within the same package. Only allowed for instance
variables.
 
Search WWH ::




Custom Search