Results 1 to 3 of 3
  1. #1
    waqar100 is offline Member
    Join Date
    May 2010
    Rep Power

    Default transient vs volatile

    I want to know WHY the volatile and final keywords are not used on the same variable?

  2. #2
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Rep Power


    What does the JLS say about those two modifiers, and then you tell us, what you think the reason might be.

    IMO it is extremely obvious why they can't (or at least why it makes absolutely no sense to even attempt to do so) be used on the same variable.

  3. #3
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Rep Power


    Your title is asking about transient vs volatile while your question is asking about volatile and final keywords. You may want to cross check your posts more carefully before posting them.

    volatile says the variable can be changed from multiple threads (no thread local caching) while final says the variable's value cannot be changed. You should now see that it doesn't make sense to use both on a variable.

Similar Threads

  1. Transient & Local
    By Supamagier in forum Advanced Java
    Replies: 5
    Last Post: 04-28-2009, 02:35 AM
  2. Transient & Volatile
    By Deepa in forum New To Java
    Replies: 2
    Last Post: 12-05-2008, 09:30 AM
  3. Transient vraible
    By serjant in forum Advanced Java
    Replies: 9
    Last Post: 11-10-2008, 02:13 PM
  4. Demonstration of the transient keyword
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-16-2008, 11:09 PM
  5. transient keyword
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-11-2007, 10:27 AM

Posting Permissions

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