aspose file tools*
The moose likes Beginning Java and the fly likes (T) in Pair<T> cannot be applied to (Pair<T>) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "(T) in Pair<T> cannot be applied to (Pair<T>)" Watch "(T) in Pair<T> cannot be applied to (Pair<T>)" New topic
Author

(T) in Pair<T> cannot be applied to (Pair<T>)

Jon Camilleri
Ranch Hand

Joined: Apr 25, 2008
Posts: 660



Error

C:\Documents and Settings\Jon\workspace\JavaDev\corejava8\v1ch12\PairTest1\Pair.java:25: setSecond(T) in Pair<T> cannot be applied to (Pair<T>)
p.setSecond(p);
^
1 error




Core Java Vol I (8th Ed) chp 12 p.637


Jon
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14164
    
  19

Look closely at what you're trying to pass to setSecond() in line 25. Does that match what the setSecond method expects or not?


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Jon Camilleri
Ranch Hand

Joined: Apr 25, 2008
Posts: 660

Jesper de Jong wrote:Look closely at what you're trying to pass to setSecond() in line 25. Does that match what the setSecond method expects or not?



Oops..
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: (T) in Pair<T> cannot be applied to (Pair<T>)