What are Transient and Volatile Modifiers?
Answer Posted / harika.thota001@gmail.com
we can use volatile in the application where a lot of threads are working simultaneously. Each thread having its local copy for instance variable. If we use volatile then it will become master copy. All will access the master copy. so whatever is latest we can use.
While Transient is used in the case of serialization.
Serialization is a process of writing an object in the files.
if we use prefix transient with variable than that variable value will not store when we write the object in the file.
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How would you format a date in java? I.e. In the ddmmyyy format?
What is square root in java?
How we can make copy of a java object?
What is the use of System class?
What is runtime locatable code?
What is static variable with example?
whatis Home interface and Remoteinterface? with example?
What is used of static keyword in java?
Can the interface be final?
What is array pointers ?
What is an infinite loop? How infinite loop is declared?
What is the difference between yield() and sleep()?
Explain about the interpreter in java?
Give example to differentiate between call by value and call by reference.
How many threads does a core java have?