Results 1 to 7 of 7

Thread: What is volatile keyword in Java?

  1. #1
    Registered sulbha's Avatar
    Join Date
    Dec 2014
    Location
    Bangalore
    Posts
    338

    What is volatile keyword in Java?

    What is volatile keyword in Java?

  2. #2
    Registered
    Join Date
    Nov 2017
    Location
    Sao Paulo
    Posts
    159
    The volatile keyword in Java is poorly documented, poorly understood, and rarely used.volatile is used to indicate that a variable's value will be modified by different threads.

  3. #3
    Registered
    Join Date
    Oct 2016
    Posts
    270
    Volatile variable in Java is a special variable which is used to signal threads, compiler that this particular variables values is going to be updated by multiple thread inside Java application. By making a variable volatile using volatile keyword in Java,application programmer ensures that its value should always been read from main memory and thread should not used cached value of that variable from there own stack.
    Best Android Training | Devops Training | SQL Server Training and many more IT courses.

  4. #4
    Registered
    Join Date
    Jan 2018
    Posts
    31
    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.

  5. #5
    Registered
    Join Date
    May 2017
    Posts
    29
    As I know Each thread has its own stack, and so its own copy of variables it can access. When the thread is created, it copies the value of all accessible variables in its own memory. The volatile keyword is used to say to the jvm "Warning, this variable may be modified in an other Thread". And remember one thing use penetration testing so that there will be no vulnerability related errors.

  6. #6
    Registered
    Join Date
    Nov 2016
    Posts
    551
    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.

  7. #7
    Registered RH-Calvin's Avatar
    Join Date
    Mar 2017
    Location
    Forum
    Posts
    533
    Volatile keyword is a qualifier that is applied to a variable when it is declared. It tells the compiler that the value of the variable may change at any time--without any action being taken by the code the compiler finds nearby. A variable should be declared volatile whenever its value could change unexpectedly.
    Cheap VPS Hosting | VPS Starting from $12 PER Year
    Cheap Dedicated Server | Unmetered Bandwidth | Free Setup and IPMI

Similar Threads

  1. Difference between Keyword Proximity And Keyword Density
    By Nexevo Technologi in forum Search Engine Optimization
    Replies: 5
    Last Post: 02-20-2018, 09:32 PM
  2. What is The Difference Between Keyword Planner or Keyword Research..?
    By swatijain2233 in forum Search Engine Optimization
    Replies: 4
    Last Post: 11-24-2017, 10:29 PM
  3. looking for java vps
    By Paul-Henri in forum Web Hosting & Servers
    Replies: 4
    Last Post: 12-30-2015, 04:57 AM
  4. Keyword_Keyword and Keyword-Keyword, any difference?
    By organ in forum Search Engine Optimization
    Replies: 3
    Last Post: 03-07-2006, 08:37 AM
  5. java help
    By VietBoyVS in forum Website Programming & Databases
    Replies: 3
    Last Post: 05-01-2004, 12:49 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •