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. Product refer to category of Items and hence can't be associated to a particular Stock keeping unit. Items can only be targeted while creating promotions.
Help us improve. Please let us know the company, where you were asked this question :
Ans. String class has a public method intern() that returns a canonical representation for the string object. String class privately maintains a pool of strings, where String literals are automatically interned.
these are automatically interned so as to have efficient String comparison using == operator instead of equals which is usually slower.
Help us improve. Please let us know the company, where you were asked this question :
Ans. 1. Security and Safety - They can be shared across multiple threads as they are thread safe. Moreover, it protects then from bad state due to interception by the other code segment. One such problem due to mutability and access by alternate code segment could be the change of hash code and then the impact on its search with hash collections.
2. Reuse - In some cases they can be reused as only one copy would exist and hence it can be relied upon. For example - String Pool
Help us improve. Please let us know the company, where you were asked this question :
Ans. Lazy Initialization means , Load Dependencies when required. Which means less load on application resources as only required data is loaded upfront. It's not only good for better performance but for better resource utilization too.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Binary tree is a tree in which each node has up to two children.Tree is a data structure composed of nodes.Each tree has a root node(not necessary in graph theory). The root node has zero or more child nodes.Each child node has zero or more child nodes, and so on.The tree cannot contain cycles.
Help us improve. Please let us know the company, where you were asked this question :
Ans. int duplicateArray[] = { 1, 2, 2, 3, 4, 5, 6, 8, 9}
Set unique = new HashSet();
for (int i = 0; i < duplicateArray.length; i) {
if (unique.contains(duplicateArray[i])) {
System.out.println(duplicateArray[i]);
} else {
unique.add(duplicateArray[i]);
}
}
Complexity O(n) = nHashSet contains and add has O(n) = 1
Help us improve. Please let us know the company, where you were asked this question :
Ans. Its used to access the object properties using the object reference or class properties using the Class Name. Moreover its used to access the classes and Interfaces of a package.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Sitemesh is a web page layout and decoration framework by OpenSymphony. SiteMeshFilter can intercept the requests and then build UI components (based on configuration) then renders the final page.
Help us improve. Please let us know the company, where you were asked this question :
Ans. filter tag speficies the filter name and respective class for handling filter action whereas filter mapping maps the filter to the url patterns ( specifying the url that needs to be intercepted )
Help us improve. Please let us know the company, where you were asked this question :
Ans. Yes its useless if we are not going to use its objects within Hash collection, For example - HashSet , HashMap. HashCode is used internally by these collections for Search.
Help us improve. Please let us know the company, where you were asked this question :
Ans. We can follow the same design which we follow in singleton Classes. We can have a static counter that will keep the count of number of objects already created, We can keep the constructor private and being called through the static method. We can keep incrementing the counter before calling the constructor and put a check to call only if it's lesser than n.
Help us improve. Please let us know the company, where you were asked this question :