Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Arrays of generics  RSS feed

 
Alina Petra
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which of the following lines can be compiled?

a)Basket<Apple>[] b = new Basket<Apple>[10];

b)Basket<?>[] b = new Basket<Apple>[10];

c)Basket<?>[] b = new Basket<?>[10];

d)public <T> T[] test() {return null;}

e)public <T> T[] test() {return new T[10];}

Can anyone give the right answer followed by explanation?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!