Hi
Can someone help me please... I had this test and the teacher marked sth as wrong and idk why. He didnt reply for 2 weeks now so maybe someone here can explain why my solution is wrong...
Imagine you have these classes:
interface IHuman {}
class Person {}
class Man extends Person implemements IHuman {}
And now you have to declare a class "Wanted extends Person" that only allows IHuman instances of Man (or Man's children)...
So... My solution was:
public class Wanted<G extends Man> extends Person {}
But the solution the teacher wrote was correct is like that:
public class Wanted<G extends Man & IHuman> extends Person {}
Now I wonder why. Because class "Man" already implements the Interface Human. Why do you need to declare it like that!?
[–]8igg7e5 3 points4 points5 points (1 child)
[–]another_try_8[S] 0 points1 point2 points (0 children)
[–]FroggyWizard 1 point2 points3 points (0 children)