Interview Questions And Answers
Q: - Why would you use a synchronized block vs. synchronized method?
Synchronized blocks place locks for shorter periods than synchronized methods.
Submitted By:-Williams Email-ID: - tomwilliams45@rediff.com
Q: - Explain the usage of the keyword transient?
This keyword indicates that the value of this member variable does not have to be serialized with the object. When the class will be de-serialized, this variable will be initialized with a default value of its data type (i.e. zero for integers).
Submitted By:-Williams Email-ID: - tomwilliams45@rediff.com
Q: - How can you force garbage collection?
You can't force GC, but could request it by calling System.gc(). JVM does not guarantee that GC will be started immediately.
Submitted By:-Williams Email-ID: -tomwilliams45@rediff.com

