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
Can java list be null?
What is difference between null and void?
What does compareto () do in java?
Explain the hierarchy of java exception classes?
What are register variables what are the advantages?
Write a program to reverse a number in java?
What is a for loop in java?
Write a method that will remove given character from the string?
You can create a string object as string str = “abc”; why cant a button object be created as button bt = “abc”;? Explain
What is finally block?
What is default exception handling in java?
What is the difference between I ++ and ++ I in java?
How will you call an Applet using Java Script Function?
What are the different data types in java?
Explain an intermediate language?