Consider the following code:
MyClass myClass= new MyExtendedClass();
myClass.method();
where MyExtendedClass be a subtype of MyClass. As i understood on a compile state compiler on the second string compiler checked of existence method method()in a source code of MyClass. Is it correct reasoning? Now consider
List<Integer> ints= new ArrayList<Integer>();
ints.add(2);
List<? extends Integer> lst = ints;
lst.get(0);
Where i can see the sources of List<? extends Integer>?
Now consider:
new ArrayList<Integer>().getClass().equals(
new ArrayList<String>().getClass());// return true.
So
In a run time classes ArrayList<Integer> and ArrayList<String> are equals, but on a compile state it is not true. Why? Where are the sources of ArrayList<String> and ArrayList<Integer>?