Search Interview Questions
| 3358 questions in repository.|
There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Have a video suggestion.
Click Correct / Improve and please let us know.
|Java - Interview Questions and Answers|
|Ans. It's weird that compiler doesn't complain if we declare transient with static variable because it makes no sense. At least a warning message saying "transient is useless in this situation" would have helped with code cleaning.|
Static variables are never serialized and transient is an indication that the specified variable shouldn't be serialized so its kind of double enforcement not to serialize.
It could be that as it makes no different to the variable behavior and hence using both keywords with a variable are permitted.
|Help us improve. Please let us know the company, where you were asked this question :|
|Like Discuss Correct / Improve  static  transient  serialization Asked in 1 Companies expert   rare|
Try 1 Question(s) Test
| Which of the following combination of keywords is illegal in Java ? |
a. static and transient
b. transient and final
c. static and synchronized
d. abstract and final
| Which keyword is used to provide explicit access of a code block to single thread ? |
|What is the use of Transient Keyword ?|
|What are transient variables in java?|
|Which of the following is true ?|
| Variables of an interface are intrinsically ... |