volatile is used to indicate that a variable's value will be modified by different threads. Declaring a volatile Java variable means: The value of this variable will never be cached thread-locally: all reads and writes will go straight to "main memory"; Access to the variable acts as though it is enclosed in a synchronized block, synchronized on itself. Inheritance shows IS-A relation. eg: class Animal {} class Dog extends Animal {} here, Dog IS-A Animal i.e., subclass is a type of super class. | 5 |
By: [email protected] On: Mon Nov 25 00:53:52 EST 2013 0 359 0 | 359 |
Are You Satisfied :4Yes1No |
Volatile keyword in Java is used as an indicator to Java compiler and Thread that do not cache value of this variable and always read it from main memory Java volatile keyword cannot be used with method or class and it can only be used with variable.This keyword also guarantees visibility and ordering , after Java 5 write to any volatile variable happens before any read into volatile variable. volatile keyword also prevents compiler or JVM from reordering of code or moving away them from synchronization barrier. to have good knowledge of this read the Multithreading topic of javatpoint. | 0 |
By: [email protected] On: Mon Nov 25 04:50:36 EST 2013 0 392 0 | 392 |
Are You Satisfied :1Yes1No |
0 | |
By: [email protected] On: Mon Nov 21 13:22:20 IST 2016 0 0 0 | 0 |
Are You Satisfied :0Yes0No |