wood burning stoves
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


Win a copy of Head First Android this week in the Android forum!
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: 662



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: 14917
    
  26

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 8 API documentation
Jon Camilleri
Ranch Hand

Joined: Apr 25, 2008
Posts: 662

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..
 
Don't get me started about those stupid light bulbs.
 
subject: (T) in Pair<T> cannot be applied to (Pair<T>)
 
It's not a secret anymore!