Modifier

     MODIFIER

    · Modifier

    · private/ default/ protected/ public

    · Non modifier

    · final/ static/ abstract

    · transient/ volatile/ native/ synchronized



    I. Class Modifier

    •  A class (A) can access to other class (B) :
    • Create a new object of class B
    •  Extend class B
    • Access to method/ property in class B

    Default Access

    • Do not use public keyword when create a new class.
    • Can be accessed by other classes in same package
    • Can not be accessed by other class if not in same package

    · 

    Public Access

    •  Use public keyword when create a new class
    •  Allow all class from other packages access and create new object


    Final Class

    • Can not be extended
    •  Other class can access via create new object

    Abstract Class

    • Do not allow initialize an object if it's abstract class
    • Can be used via extend

    II. Method/ Property Modifier