What are the Java Modifiers?
>> Monday, May 30, 2011
static:
Class:A static inner class is just an inner
class associated with the class,
rather than with an instance of the
class.
Methods:A static method is called by class name.method
(e.g Math.random()), can only access static
variables.
Variables:Class variables are
called static variables.
There is only one
occurrence of a class
variable per JVM per
class loader.
abstract:
class:An abstract class cannot be
instantiated, must be a superclass
and a class must be declared
abstract whenever one or more
methods are abstract.
methods:Method is defined but contains no
implementation code (implementation code is
included in the subclass). If a method is
abstract then the entire class must be abstract.
variables:N/A
synchronized:N/A
methods:Acquires a lock on the class for static
methods.
Acquires a lock on the instance for nonstatic
methods.
variables:N/A
transient:
class::N/A
methods::N/A
variables:variable should not be
serialized.
final:
class:It cannot inherited.
methods:Method cannot be overridden.
variables:variable should not be
serialized.
native:
class:N/A
methods:Platform dependent. No body, only signature.
variables:N/A
Class:A static inner class is just an inner
class associated with the class,
rather than with an instance of the
class.
Methods:A static method is called by class name.method
(e.g Math.random()), can only access static
variables.
Variables:Class variables are
called static variables.
There is only one
occurrence of a class
variable per JVM per
class loader.
abstract:
class:An abstract class cannot be
instantiated, must be a superclass
and a class must be declared
abstract whenever one or more
methods are abstract.
methods:Method is defined but contains no
implementation code (implementation code is
included in the subclass). If a method is
abstract then the entire class must be abstract.
variables:N/A
synchronized:N/A
methods:Acquires a lock on the class for static
methods.
Acquires a lock on the instance for nonstatic
methods.
variables:N/A
transient:
class::N/A
methods::N/A
serialized.
final:
class:It cannot inherited.
methods:Method cannot be overridden.
variables:variable should not be
serialized.
native:
class:N/A
methods:Platform dependent. No body, only signature.
variables:N/A
0 comments:
Post a Comment