aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Arrays of generics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Arrays of generics" Watch "Arrays of generics" New topic

Arrays of generics

Alina Petra

Joined: Oct 17, 2006
Posts: 26
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?
I agree. Here's the link:
subject: Arrays of generics