Access Modifiers

Summary table of Java Modifiers and Access Specifiers.

Summary table of Java Modifiers and Access Specifiers.

Summary table of Java Modifiers and Access Specifiers. The only applicable modifier for the local variable is final. The only applicable modifiers for constructor are public, private, default, protected. The modifiers which are applicable only to the method is native. The modifiers which are applicable only for variables volatile and transient. The modifiers which are applicable for classes but not ...

Read More »

What is Volatile keyword in Java?

What is Volatile keyword in Java?

What is Volatile keyword in Java? Volatile is the modifier applies only to variables and we can’t apply anywhere else. If the value of a variable keeps on changing by multiple threads then there may be a chance of data inconsistency problem. We can solve this problem by using the volatile modifier. If a variable declares as volatile then for ...

Read More »

What is Transient Keyword in Java?

What is Transient Keyword in Java?

What is Transient Keyword in Java? Transient modifier applicable only for variables but not for methods and classes. We can use a transient keyword in serialization context. At the time of serialization if we don’t want to save a value of a particular variable to meet security constraint then we should declare that variable as transient. At the time of ...

Read More »

What is Native modifier in Java?

What is Native modifier in Java?

What is Native modifier in Java? Native is the modifier applicable only to the method and we can’t apply anywhere else. The method which is implemented in non-java(mostly c and c++) are called native methods or foreign methods. The main objectives of a native keyword are To improve the performance of the system To achieve machine level or memory level ...

Read More »

What is synchronized modifier in Java?

What is synchronized modifier in Java?

What is synchronized modifier in Java? Synchronized is the modifier applicable for methods and blocks but not classes and variables. If multiple threads trying to operate simultaneously on the same java object then there may be a chance of data inconsistency problem this is called race condition. We can overcome this problem by using synchronized keyword. If a method or ...

Read More »

What is the static modifier in Java?

What is static modifier in Java?

What is the static modifier in Java? Static is a modifier applicable to methods and variables but not for classes. You can think of a ‘static’ method or field as if it were declared outside the class definition. In other words, there is only one ‘copy’ of a static field/method. Static fields/methods cannot access non-static fields/methods. We can’t declare a ...

Read More »

Responsive WordPress Theme Freetheme wordpress magazine responsive freetheme wordpress news responsive freeWORDPRESS PLUGIN PREMIUM FREEDownload theme free