File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Generic  Classes using ?" Watch "Generic  Classes using ?" New topic

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: 446

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%], OCPWCD [84%], OCEJPAD [83%]
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

I agree. Here's the link:
subject: Generic Classes using ?
It's not a secret anymore!