Short Core Java Interview Questions ?
1. Primitive data types are passed by reference or pass by value ?
Ans. Primitive data types are passed by value.
2. How to create custom exceptions ?
Ans. Your class should extend class Exception, or some more specific type thereof.
3. What is the List interface?
Ans. The List interface provides support for ordered collections of objects.
4. What is the typical use of Hashtable?
Ans. Whenever a program wants to store a key value pair, one can use Hashtable.
5. I am trying to store an object using a key in a Hashtable. And some other object already exists in that location, then what will happen? The existing object will be overwritten? Or the new object will be stored elsewhere?
Ans. The existing object will be overwritten and thus it will be lost.
6. Can a vector contain heterogenous objects?
Ans. Yes a Vector can contain heterogenous objects. Because a Vector stores everything in terms of Object.
7. Can a ArrayList contain heterogenous objects?
Ans. Yes a ArrayList can contain heterogenous objects. Because a ArrayList stores everything in terms of Object.
8. Can a vector contain heterogenous objects?
Ans. Yes a Vector can contain heterogenous objects. Because a Vector stores everything in terms of Object.
Explore posts in the same categories: Java Interview Questions