1

if I change

Team<FootballPlayer> adelaideCrows = new Team<>("Adelaide Crows");

to

Team<FootballPlayer> adelaideCrows = new Team("Adelaide Crows");

Would it be wrong or will I get any error later? And why ? wildcard cannot use at class level? like

public class B <? extends A>
Abhi
  • 4,123
  • 6
  • 45
  • 77
Kelvin
  • 31
  • 2
  • Have you *tried*? – Philipp Jul 18 '17 at 07:54
  • Possible duplicate of [When to use generic methods and when to use wild-card?](https://stackoverflow.com/questions/18176594/when-to-use-generic-methods-and-when-to-use-wild-card) – Blasanka Jul 18 '17 at 07:54
  • 2
    You're instantiating a raw type there. The compiler will let you do this, for compatibility with legacy code, but you shouldn't. If a constructor or method calls for type parameters, you should provide them (or allow the compiler to infer them using the diamond operator, per the first example). – jsheeran Jul 18 '17 at 07:54
  • Also read; https://stackoverflow.com/questions/16707340/when-to-use-wildcards-in-java-generics – Blasanka Jul 18 '17 at 07:57

0 Answers0