D:\JAVA\shekhar java\sudipto nw\TestA.java:35: addAnimal(java.util.List<Dog>in Dog cannot be applied to (java.util.List<capture of ? super Dog>
![]()
((Dog)dogList.get(0)).addAnimal(dogList);// this line does not compile
^
1 error
D: \ JAVA\shekhar java \ sudipto nw \TestParlor.java:19 : cannot find symbol
symbol : method getRent()
location : class java.lang.Object
rent=item.getRent( ) ; //cannot find symbol getRent()
^
1 error
I understand what you say but how did i break Generics?
I am sorry I could not understand you... Please explain....
The error is :
D: \ JAVA\shekhar java \ sudipto nw \TestParlor.java:19 : cannot find symbol
symbol : method getRent()
location : class java.lang.Object
rent=item.getRent( ) ; //cannot find symbol getRent()
^
1 error
Originally posted by Sudipto Shekhar:
So now what if I want to call a method in the dog class on the object that I get from the list passed to the method as argument?![]()
I my another code I face the same problem.
Originally posted by Sudipto Shekhar:
I think I did not understand the purpose of generics(from the usage of the generics in the classes I showed in the previous posts). Please guide me if I am wrong somewhere.
Don't get me started about those stupid light bulbs. |