David O'Meara wrote:firstly don't use load-on-startup for anything that isn't related to bootstrapping the SErvlet. If you want to do it then use a ContextListener instead
Secondly, if you load and store the values, why hardcode it? Sure it can be hardcoded in the generated file from the build script, but on startup you can create an instance of a class for managing this information and then read and populate the data.
No need for dynamically creating and loading a class at runtime.
Jesper Young wrote:
It's better to use class names that reflect the "is a" relationship. For example, make a class Animal, and a class Cat that extends Animal. A Cat is an Animal.
Simran Dass wrote:
THis is bec the compiler looks for the most specific method. Among printObj(Son)
and printObj(Dad) method printObj(Son) is the most specific one. So the compiler gives
no error. But when you also have printObj(intrf) together with these two methods compiler
cannot find the most specific method and hence the error.
Harpreet Singh janda wrote:Hi Sachin,
As there is not exact match for a method printObj with a parameter "GrandSon". So the compiler will check for any other method which can be used in a polymorphic way, means any overloaded version which can be used by passing "GrandSon" object. Candidate methods are those which accepts the parent class of "GrandSon". In your code there are three such methods :
All of these three methods can be called by passing "GrandSon" as an argument. So compiler will be confuse because of multiple eligible methods and will not be able to conclude any single method to call, Hence throws an exception regarding ambiguous methods.