More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
Ans. Platform independent language means once compiled you can execute the program on any platform (OS). Java is platform independent. Because the Java compiler converts the source code to bytecode, which is Intermediate Language. Bytecode can be executed on any platform (OS) using JVM( Java Virtual Machine).
Help us improve. Please let us know the company, where you were asked this question :
Ans. When we Mock an object and then make a reference to any method using mocked object reference , java never makes a call to that method and looks for mocked value to be returned or null if none specified. But If we want that to be overridden and want java to make actual method call upon using mocked object reference, this method can be used.
Help us improve. Please let us know the company, where you were asked this question :
Ans. ConcurrentHashMaps provide unlimited read operation fro multi threaded environment. For write operation only one thread can change value for particular segment of map.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Enums in Java is a facility to have objects upfront and use them as constants. Even if such a facility is not available , a workaround could be achieved.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Collections in Java is nothing but a library implementation for data structures and algorithm. If it's not available , we might have to include some other library or provide our own implementation.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Base Class is a relative term. For example - Class Vehicle is a Base class of Class Car. Even though Base class is derived in this case , there is no restriction on instantiation of Vehicle class.
Abstract Class is a class that is meant only to be a Base Class and not allowed to be instantiated.
Abstract Class is a Base Class that isn't allowed to be instantiated and is only meant for carrying definition to derived class and help participate in runtime polymorphism.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Default size is 10.
Regard how size will increase.
Inside add() method there is one method called ensureCapacity() which will check list has enough size available.
This ensureCapacity() method if found size of list need to increase then it will call grow() method which will create new list of extra size and copy existing list data to new one and return.
Help us improve. Please let us know the company, where you were asked this question :