Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Generics Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Generics" Watch "Generics" New topic
Author

Generics

Asha Pathik
Ranch Hand

Joined: Feb 08, 2006
Posts: 143
Hi,
I've written this code. Could anyone tell me what should I write in place of /* Commented part */ so that it compiles and invoke the getName() method on each of the object stored in aList.

Thanks


SCJP 1.5
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367


Notice here that ia is the iterator, it is not an element from the list.

If you change the print statement to



you should get the results you want.

Note also that you have a semicolon where you don't need it in the while loop.
Asha Pathik
Ranch Hand

Joined: Feb 08, 2006
Posts: 143
Thanks Keith. Its working now.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Generics
 
Similar Threads
Question for Wildcards in Collection
Help me fix this-Part-2,so I can compile(generics doubt)
Help Me Downcast
Help me fix this,so I can compile(generics doubt)
Generics and ? symbol