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


Please Help Members By Posting Answers For Below Questions

How do you check if two strings are equal in java?

587


What do you know about the garbage collector?

613


How define set in java?

514


What is 32 bit float?

563


Addition to previous section relative word 5th one was Putrid ans: rotten, also there was prob. in 1st section on bucket weight ans:10kg, also there was a prob. on train speed to find bridge length ans:800 mtrs.

1610






if u open login & logout ,how can udisplay the timelogin & logout members ?

1756


Can we store variables in local blocks?

788


What is the tradeoff between using an unordered array versus an ordered array?

664


is it possible to instantiate the math class?

535


What is an example of declaration?

525


Is void a wrapper class?

536


What about main thread in java?

650


What is the biggest integer?

553


How do you sort a string in java?

540


What are exception handling keywords in java?

609