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. Spliterator has better performance potential than iterators but only if the potential is used. Spliterator can iterate streams in parallel as well as in sequence whereas iterator can only iterate in sequence.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Though there are many differences the way internally they both iterates the collections and streams respectively, but the main difference in performance that is achieved by spliterator as it can iterate Streams in Parallel whereas iterator only iterates collections sequentially.
Help us improve. Please let us know the company, where you were asked this question :
Ans. NumberFormatException is the exception that Java throws when we try to convert one data type to the Number data type but the value is not parsable to be a Number.
For example , the following code will result in the NumberFormatException
String string = "Buggy";
int strtoInt = Integer.parseInt(string);
Help us improve. Please let us know the company, where you were asked this question :
Ans. When executing tests it is common that multiple tests need similar objects to be created before they can run. @before specifies a method that provide that initialization for the set of Unit Tests.
Help us improve. Please let us know the company, where you were asked this question :
Ans. This exception usually occur if we try to register the bean with name already present in the registry or repository. Usually this happens when multiple tests are executed at once in single container.
Help us improve. Please let us know the company, where you were asked this question :
Ans. No, member variables of a interface are final by default.
The final ensures the value assigned to the interface variable is a true constant that cannot be re assigned by program code.
Help us improve. Please let us know the company, where you were asked this question :
Ans. I use trace for debugging purpose. Info for displaying some important info, thought its rare as we have enabled info logging in production. Warn in case something went wrong but we still resume the flow in spite of it or have take alternate flow as its expected sometimes. Error logging in case it was completely unexpected and mostly when it breaks the flow.
Help us improve. Please let us know the company, where you were asked this question :
Ans. We can use an expiration map whose entries gets expired after a certain interval and then we can put the logic to retrieve the entries if its expired in map.
Alternatively we can create a separate class and make map its element. We can refresh the map in this class periodically by using a monitoring thread within static block.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Coupling is the degree of interdependence between software modules, a measure of how closely connected two modules are or the strength of the relationships between modules.
Cohesion refers to the degree to which the elements of a module belong together. Cohesion measures the strength of relationship between pieces of functionality within a given module.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Yes, When either we don't want an object to be created ( class having all static elements and hence not required ) or object to be created using a static method or static block.
One such example could be a situation when we would like app to load objects at start up and we would like to restrict new object creation by any request.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Item is a sale-able merchandise where as Product is a group of sale-able merchandise which share certain attributes. For example - Cell phone is a product whereas Samsung Galaxy S2 - White is an item.
Quantity is always attached to SKU ( Stock keeping unit ) or items. Product quantity has no relevance in terms of identify the current stock or reorder condition.
Help us improve. Please let us know the company, where you were asked this question :