Saturday, May 24, 2014

Class, Method, and Variable Modifiers






The following are class, method, or variable modifiers:

·        abstracta method or class that can not be instantiated, and which may define methods to be overwritten.
·        classkeyword used to specify a class.
·        extendsused to indicate the super-class that a subclass is extending.
·        finalmakes it impossible to extend a class, override a method, or reinitialize a variable.
·        implementsused to indicate the interfaces that a class will use.
·        interfacekeyword used to specify an interface.
·        nativeindicates a method is written in a platform-dependant language, such as C.
·        newused to instantiate an object by invoking the constructor method.
·        staticmakes a method or variable belong to a class.
·        synchronizedindicates that a method can be accessed by only one thread at a time.
·        transientindicates which variables are not to have their data written to an ObjectStream.
·        volatileindicates a variable may change out of sync due to its usage in threads.



Variables
Methods
Classes
Access Modifiers



private
x
x

protected
x
x

none (default)
x
x
x
public
x
x
x




Special Modifiers(Not Access Modifiers)



abstract

x
x
final
x
x
x
native

x

static
x
x
x
synchronized

x
x
transient
x


volatile
x





























































No comments:

Post a Comment