File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Generic  Classes using ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Generic  Classes using ?" Watch "Generic  Classes using ?" New topic
Author

Generic Classes using ?

Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634

As given in the THREADS notes by By:
Prithvi Sehgal/Beenish Zaidi the following code should Compiles fine
But,it doesnot compile .






OCPJP 6.0 93%
OCPJWCD 5.0 98%
Arjun Srivastava
Ranch Hand

Joined: Jun 23, 2010
Posts: 432

mohitkumar gupta wrote:


you cannot use wildcards in class and method declaration,it has been specified specifically in the book.


SCJP 6 | FB : Java Certifications-Help. | India Against Corruption
Prasad Kharkar
Ranch Hand

Joined: Mar 07, 2010
Posts: 438

I think you are mixing up generics and wildcards
if you want to use generics then the syntax for that is



and if you want to use wild cards then we can write as follows



SCJP 6 [86%] June 30th, 2010
OCPWCD [84%] March 26th, 2013
If you find any post useful, click the "plus one" sign on the right
Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634

Thanks
 
jQuery in Action, 2nd edition
 
subject: Generic Classes using ?
 
Similar Threads
Java From The Command Line - Communicating With The User
Inner Class
Problem with casting
First Ant project not compiling
Returning array To Method