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. Priority inversion is a problematic scenario in scheduling in which a high priority task is indirectly preempted by a lower priority task effectively inverting the relative priorities of the two tasks.
Help us improve. Please let us know the company, where you were asked this question :
Q1425. What are the benefits of using prepared statements ? Does that benefit extend only if similar prepared statements are used within a application or it extends even with multiple applications having similar prepared statement ?
Ans. Prepared Statements helps in reuse of database execution plan which can be cached at Database level and hence helps achieving faster execution and performance. As cached ps objects are creating at Database level and not application level, the use and benefit extends across multiple applications.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Executor - Simple Interface that supports launching new tasks.
ExecutorService - Subinterface of Executor, which adds features that help manage the lifecycle, both of the individual tasks and of the Executor itself.
ScheduledExecutorService - Subinterface of ExecutorService, supports future and-or periodic execution of tasks.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Include directive includes the file at translation time (the phase of JSP life cycle where the JSP gets converted into the equivalent servlet) whereas the include action includes the file at runtime.
Help us improve. Please let us know the company, where you were asked this question :
Ans. setMaxUploadSize is used to set the maximum size of uploads that can be made in a request whereas setMaxUploadSizePerFile sets the maximum size per uploaded file.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Java provides a default constructor ( no argument ) if no constructor is provided by the programmer. Java makes a check during pre compilation if there is any constructor provided by the programmer. If any constructor is provided, Java understands that programmer has provided all the mechanism for initialization and construction of the object and may not even intend to create objects by calling a no argument constructor. For example - One may like to have objects created with self defined state otherwise restrict its creation.
We make the constructor private if we want to make a class singleton as we would like to restrict creation of new objects using new operator and default constructor. Similar could be the situation wherein we would like to construct objects in a particular manner only.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Constructor's objective is to initialize member elements. If we don't deviate from that and don't have methods with logic in them, I don't see an issue with constructor's calling other methods assuming the methods are doing nothing but initialization. There are situations wherein we classify the member elements based on their type and hence having different initialization methods for different element types will give a better abstracted way to initialize them.
Help us improve. Please let us know the company, where you were asked this question :
Ans. I would avoid that. If we need to initialize member elements differently on the basis of some condition, I would prefer having overloaded constructors. I don't see a need to have a loop for initializing member elements unless the count of elements is huge and they all need to be initialized with common value.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Classes having only static methods in java is called util classes. As they don't have specific object state, they are basically intend to have shared code and state through static elements and methods. They save resources by sharing code.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Though it's useful but it's not as useful as overriding member or object methods. We cannot achieve polymorphic behavior with static methods by overriding their definition in derived class.
Help us improve. Please let us know the company, where you were asked this question :
Ans. I like to keep the names in Capital Camel case. Moreover I prefer to keep the names for classes, enums and interfaces such that they are easily distinguishable just by the pattern of their names.
Help us improve. Please let us know the company, where you were asked this question :