aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes sample code in Chapter 7 of K&B SCJP 6.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "sample code in Chapter 7 of K&B SCJP 6.0" Watch "sample code in Chapter 7 of K&B SCJP 6.0" New topic
Author

sample code in Chapter 7 of K&B SCJP 6.0

zheng li
Ranch Hand

Joined: Jun 16, 2009
Posts: 56


it's written in the book that
We get one error
kathy% javac1.5 RentalGeneric.java
RentalGeneric.java:38: cannot find symbol
symbol : method add(Cat)
location: interface java.util.List<Car>
carList.add(new Cat("Fluffy"));
1 error


But on my computer, everything is just fine. no compiler error and no runtime exception.
java6(java5), eclipse, windowxp

Bob Wheeler
Ranch Hand

Joined: Apr 24, 2009
Posts: 317
You can't have that error in your code, because you have forgotten to add this line:

This list works for cars, but not for cats called Fluffy.
cheers
Bob


SCJP 6 - SCJD - SCWCD 5 - SCBCD 5
JavaEnterpriseEditionFaq - TomcatFaq
zheng li
Ranch Hand

Joined: Jun 16, 2009
Posts: 56
oh, yes, you are right.
it's Cat not Car.
Thank you
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: sample code in Chapter 7 of K&B SCJP 6.0