We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ae7cf19 commit d2aa347Copy full SHA for d2aa347
1 file changed
JavaMultiThreadingCodes/src/VolatileKeyword_2/App.java
@@ -15,6 +15,13 @@
15
* </a>
16
*
17
* @author Z.B. Celik <celik.berkay@gmail.com>
18
+ *
19
+ * Normally, the below program will stop running after you
20
+ * press return. But in some system it won't. As after
21
+ * Java optimize the code, one thread doesn't expect other
22
+ * thread to modify its fields, that is the value of
23
+ * running. So to guarantee it works on all system or OS,
24
+ * we use volatile. It prevents cache caching the variables.
25
*/
26
import java.util.Scanner;
27
0 commit comments