sweety singh

Ranch Hand
+ Follow
since Dec 15, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by sweety singh

anyone please answer this question...
is this a valid interface declaration...??
thanks for the reply... i wanted to ask one more thing...
in the following code... when the minor class's constructor calls its base class constructor with arguments.. ie super(y) at line 1.. is it that 'y +=3' also executes or before it is executed the base class constructor is called.??? then when is it executed.... same is the case with this()..

[ June 08, 2008: Message edited by: sweety singh ]

the answer of this question is Compilation fails... and the explanation says "Uber's constructor's call to this is looking for a no- argument constructor that doesn't exist"... i have not understood this... i have got confused please explain me this...


this question is from K&B master exam...
the answer of this code is a compilation error at #1.. in the explanation of this program says "only instance methods can be overridden and calls to super only apply to overridden methods" i have not understood this...
please expalin me what is menas... and what is System.out.print() statement doing its only for input at the command prompt i guess???

thanks in advance...
the book says that the question mark works when declaring a reference for a varible its does not work for generics class and method declaration.. i did not understand this...
please tell me the difference between <?> and a type variable <T>,<E>... when are they used...
thanks...
hi... can anybody tell me what is super doing in this code at line 1 2 3 4... thanks...



[ May 25, 2008: Message edited by: sweety singh ]
[ May 25, 2008: Message edited by: sweety singh ]
hey thanks all... i have understood...
but dog also extends animal.... i am confused... i did not understand..
hey thanks for that reply... but i want to ask you one thing... in the following code..

Code:

public void addAnimal(List<? extends Animal> animals)

{
animals.add(new Dog()); //1
}

in line 1.. the book says "No! can't add if we use <? extends Animal>"
why is it so...
[ May 25, 2008: Message edited by: sweety singh ]
[ May 25, 2008: Message edited by: sweety singh ]
hi all... can somebody tell me the difference between <? extends Animal> and <? super Animal> with example.... i am slightly confused...
thanks in advance...
so is collections a type of generics..
congratulations!!!
16 years ago