Use of volatile keyword makes sense when there is a shared object that is being accessed / modified by multiple threads .Using volatile keyword ensures that variable is never kept in register (stack) for a thread . It will always be read from main memory .
A thread will never cache the value of a volatile declared variable in its stack space . so when another thread or by same thread any modification occurs on the volatile variable . its immediately reflected .However i have not found any running example to show the volatile affect clearly .