When using a wildcards some methods (e.g. ArrayList.set
) cannot be used and return an error message similar to
The method set(int, capture#3-of ?) in the type List is not applicable for the arguments (int, String)
I have read why this is the case and would like to know how this is done. That is how does the compiler know that some methods are applicable (e.g. List.get(int)
) but others are not?