Modifiers for data members and methods in java
In a Java Program several modifiers are used at the time when we declare members(variable) and methods in the program. Some of widely used modifiers for data members and methods in java programming are as follow:
(1) static – Define a class variable and Define a class method.
(2) final – Define a constant in context of data member and when it is used with method then methods can not overridden.
(3) abstract– abstract modifier is not relevant to data member. It has its significance for a class name and methods. in context of a methods when we use abstract keywords with methods then we can not override that methods
(4 ) synchronized – This modifier is not relevant to data member. It has its significant to method it means when we used synchronized keyword with method name then only one thread can execute that method at a time.
(5) native – Not relevant to data member. but when we use native is used with method then it indicates that method is implemented in other language.
(6) transient – When a data member is declare as transient it means that value of that member can not be included when the object is serialized. This modifier is not relevant to method.
(7) volatile – When a variable is declare as volatile then the compiler will not attempt to optimize access to the value of that variable. This modifier is not relevant to method.
Keywords: definition of transient,volatle, native, static , final keywords in java