Modifiers are basically keywords that are added to change the meaning of a definition.They can be broadly classified to two types:
1.Access control modifier: They basically control the visibility.They can be:
1.private: The data members or member methods declared private have their scope only within the class.
2.public:The data members or member methods declared public can be declared outside the visibility of the class.
Output: I m a Fan
3.protected:It has the scope within the package and all its sub classes.
4.default(package):It has the scope within the same package.
2.Non Access modifiers:They provide special properties to variables and methods.
1.Final:A field declared final cannot be modified.We must initialize the final field at the time of declaration.
2.Static:These modifiers are used to create class variables and class methods that can be accessed without instance of a class.
3.Abstract:These modifiers are used to create abstract classes and methods.
4.Synchronized :They can be accessed by only one thread at a time.
5.Volatile:They are used in multithreading programming.