Hey I have a question about generics on Java.
Basically I have two classes. One is the interface, and the other is the implementation of that interface.
Hand.java:
public interface Hand {
void move(double x, double y, double z, int rotaton);
}
RightHand.java:
public class RightHand implements Hand {
@Override
public void move(double x, double y, double z, int rotaton) {
...Logic...
}
}
What I'm trying to achieve (Failing);
public static void main(String[] args) {
List<RightHand> rightHands = new ArrayList<RightHand>();
...Add to rightHands logic...
moveHandsRandomly(rightHands);
}
public static void moveHandsRandomly(List<Hand> hands) {
...Move Logic...
}
It's giving me a syntax error on moveHandsRandomly(rightHands). What i don't understand is, isn't RightHand essentially Hand? Why can't i use this logic?