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 Problem's Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Generic Problem Watch "Generic Problem New topic
Author

Generic Problem's

Mohit G Gupta
Ranch Hand

Joined: May 18, 2010
Posts: 634


Getting compiler error
but,Integer extends Number
WHy


OCPJP 6.0 93%
OCPJWCD 5.0 98%
Prasad Kharkar
Ranch Hand

Joined: Mar 07, 2010
Posts: 438

What I can infer from this is as follows
  • Syntax is correct, no problem about that
  • this statement means, we can either instantiate a list of Number class or any subclass of that class
  • Maybe this is because Number is abstract class and hence it cannot be instantiated


  • This is just a guess
    let the experts comment over this

    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
    Ankit Garg
    Sheriff

    Joined: Aug 03, 2008
    Posts: 9293
        
      17

    Getting compiler error

    What compiler error are you getting?? The syntax is correct, it should compile fine. Have you imported List and ArrayList properly??


    SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
    Trivikram Kamat
    Ranch Hand

    Joined: Sep 26, 2010
    Posts: 155
    mohitkumar gupta wrote:
    Getting compiler error


    Hi Mohitkumar, ShowSomeEffort and TellTheDetails
    What's the exact error are you getting?

    There is no compile error in the given line.
    Remember that import statement is required.

    The code below runs fine:


    OCPJP6
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Generic Problem's