当前位置:编程学习 > JSP >>

简述modifier(public,protected,private我就不说了,大家都比较熟了)

答案:static
    *    The modifier static can be applied to an inner class, a method and a variable.    
    *    You cannot access non static variables from within a static method.    
    *    A static method cannot be overriden to be non static in a child class.
    *    A non static (normal) method cannot be overriden to be static in a child class.
        
native
    *    The native modifier is used only for methods and indicates
        that the body of the code is written in a language other than Java such as C and C++.
    *    Native methods are often written for platform specific purposes
        such as accessing some item of hardware that the Java Virtual Machine is not aware of.
        Another reason is where greater performance is required.
    *    the native modifier means that the method can have no body.
        
abstract
    *    The abstract modifier can be applied to classes and methods.
    *    If a class has any abstract methods it must be declared abstract itself.

final
    *    The final modifier can be applied to classes, methods and variables.
    *    A final class may never be subclassed.
    *    Any methods in a final class are automatically final.
    *    The final modifier indicates that a method cannot be overriden.
    *    A final variable cannot have it's value changed and must be set at creation time.
    
synchronized
    *    The synchronized keyword is used to prevent more than one thread
        from accessing a block of code at a time.
        
transient
    *    The transient keyword indicates that a variable should not be written out
        when a class is serialized.
        
volatile
    *    The volatile keyword tells the compiler a variable may change asynchronously due to threads.
    

上一个:简述I/O
下一个:HowTo----如何将Tomcat 4安装成服务(Service)?

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,