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
What is the difference between JDK and JVM?
Are private methods final?
How do you add an element to a set in java?
What is continuity of a function?
Explain the term virtual machine?
Are arrays primitive data types?
What is a vararg?
What are the two types of streams offered by java 8?
Can I declare class as static or private?
How do you sort objects in java?
What is the range of the short type?
What is the difference between overriding and overloading in OOPS.
Explain the overview of UDP messaging.
What is illegal identifier in java?
What is the hashcode () and equals () used for?