Results 1 to 5 of 5

Thread: What is volatile keyword in Java?

  1. #1
    Senior Member
    Join Date
    Apr 2013
    Posts
    459
    Thanks
    0
    Thanked 3 Times in 3 Posts

    What is volatile keyword in Java?

    What is volatile keyword in Java?

  2. #2
    Senior Member RH-Calvin's Avatar
    Join Date
    Apr 2015
    Location
    Forum
    Posts
    638
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Instead of synchronized variable in Java, you can have java volatile variable, which will instruct JVM threads to read value of volatile variable from main memory and don't cache it locally. If a variable is not shared between multiple threads no need to use volatile keyword with that variable.
    Cheap VPS | $1 VPS Hosting
    Cheap Windows VPS | Remote Desktop Access
    Cheap Dedicated Server | Free Setup and IPMI

  3. #3
    Member
    Join Date
    Jan 2014
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Volatile variable in java diverts read and write operation towards main memory instead of locally cached memory

  4. #4
    Junior Member
    Join Date
    Apr 2018
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    As I know 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. You can use any language to develop your software or web, but you should have a application dr plan so hat you will not face any disaster related problems.

  5. #5
    Junior Member
    Join Date
    Mar 2017
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Volatile is a keyword which is used to create a class. It is nothingbut a variable.

Similar Threads

  1. Is delete a keyword in Java?
    By beingchinmay in forum Web Programming
    Replies: 0
    Last Post: 10-21-2016, 12:38 PM
  2. Java as a second Language
    By kat in forum Web Programming
    Replies: 2
    Last Post: 04-03-2013, 06:16 AM
  3. Java Programming Language
    By zsazsa in forum Website design
    Replies: 2
    Last Post: 03-25-2013, 07:14 AM
  4. Does JAVA works with Sql server?
    By abbie in forum Web Programming
    Replies: 1
    Last Post: 01-16-2013, 03:42 PM
  5. Good Books for Java ??
    By tipumaka in forum Web Programming
    Replies: 1
    Last Post: 01-09-2013, 08:11 PM

Tags for this Thread

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
  •