Home / CSE MCQs / JAVA MCQs :: Discussion

Discussion :: JAVA MCQs

  1. Which of these modifiers can be used for a variable so that it can be accessed from any thread or parts of a program?
  2. A.
    transient
    B.
    volatile
    C.
    global
    D.
    No modifier is needed

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    The volatile modifier tells the compiler that the variable modified by volatile can be changed unexpectedly by other part of the program. Specially used in situations involving multithreading.


Be The First To Comment