Questions & Answers
Java Q&A
- equals() implemented and hashCode() not, Is there any issue, if no collection in use?
- Difference b/w JAX-WS ans JAX-RS
- Difference b/w load() and get()
- How to test database by unittest.
- Which RunTimeException may be thrown by java.lang.wait() method (java.lang.IllegalMonitorStateException)
- Exceptions in finalize method are ignored.
- what is Dynamic binding?
Dynamic Binding refers to the case where compiler is not able to resolve the call and the binding is done at run-time only. (as overridden method call decided by run-time object)
- If we have 3 interfaces A,B,C which are having common method - display() and we are implementing these 3 interfaces in interface D then how this will be handled and which display() will be implemented.
- The first interface in order must be implemented
- How to make a class non extendable?
- What is difference between ClassNotFoundException and ClassDefNotFoundException?
- ClassNotFoundException: class not found at run-time in class-path using class.forName(...) or loadClass() methods.
- ClassDefNotFoundException: class not found at run-time in class-path and in present at compile time. class is referenced with Java’s “new” operator (i.e. static loading).
- What is difference between HashMap, HashTable & ConcurrentHashMap?
- HashTable: maps keys to values. Any non-null object can be used as a key or as a value.
- HashMap: The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized (Not Thread-safe) and permits nulls
- ConcurrentHashMap: Even though all operations are thread-safe, retrieval operations do not entail locking, and there is not any support for locking the entire table in a way that prevents all access. This class is fully interoperable with Hashtable in programs that rely on its thread safety but not on its synchronization details.
Conclusion: If a thread-safe implementation is not needed, it is recommended to use HashMap in place of Hashtable. If a thread-safe highly-concurrent implementation is desired, then it is recommended to use ConcurrentHashMap in place of Hashtable.
- What is Error ?
- Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch.
- How hashCode is calculated for custom object like Employee.
No comments:
Post a Comment