TLDR :
Can we say ArrayList<?> is superclass of ArrayList<Integer> ?
NO but we can say it is supertype of ArrayList<Integer>
Then is right to say A<?> is super class of B<Integer> ?
YES and we can also say it is supertype of B<Integer>
Also note that inheritance is used only in context of subclass or super class and not subtype or supertype.
Quick Reference
First thing you need to understand is class is a type in java.
We will see below that wherever it is valid to use the term sub/super class , it is valid to use sub/super type but not vice versa
Let me now define superclass. According to JLS 8.1.4
Given a (possibly generic) class declaration for C<F1,...,Fn> (n ≥ 0,
C ≠ Object) (Fi here is type parameter), the direct superclass of the class type C<F1,...,Fn> is
the type given in the extends clause of the declaration of C if an
extends clause is present, or Object otherwise.
Let C<F1,...,Fn> (n > 0) be a generic class declaration. The direct
superclass of the parameterized class type C<T1,...,Tn>, where Ti (1 ≤
i ≤ n) is a type (argument), is D<U1 θ,...,Uk θ>, where D<U1,...,Uk> is the
direct superclass of C<F1,...,Fn>, and θ is the substitution
[F1:=T1,...,Fn:=Tn].
A class A is a subclass of class C if either of the following is true:
a) A is the direct subclass of C
b)There exists a class B such that A
is a subclass of B, and B is a subclass of C, applying this definition
recursively.
Class C is said to be a superclass of class A whenever A is a subclass
of C.
To explain the thing in little simple words , consider a simpler example :
C<F1,...,Fn> be ArrayList<T> and C<T1,...,Tn> will be say ArrayList<Integer> in above definition. T is type parameter and we instantiate it with Integer which is type argument.
[ What did we meant by θ is the substitution [F1:=T1,...,Fn:=Tn] ? ]
Now, Does A<?> comes in extends clause of A<Integer> ? (I know it is stupid to ask such a structure , but let us be strict with definition) . No it does not. Generally , in extends we mention a different class type altogether.
Now, let us see definition of sub/super type. By JLS 4.10.2
Given a generic type declaration C<F1,...,Fn> (n > 0), the direct
supertypes of the parameterized type C<T1,...,Tn>, where Ti (1 ≤ i ≤
n) is a type, are all of the following:
D<U1 θ,...,Uk θ>, where D<U1,...,Uk> is a generic type which is a
direct supertype of the generic type C<T1,...,Tn> and θ is the
substitution [F1:=T1,...,Fn:=Tn].
C<S1,...,Sn>, where Si contains Ti (1 ≤ i ≤ n) (§4.5.1).
The type Object, if C<F1,...,Fn> is a generic interface type with no
direct superinterfaces.
The raw type C.
Now by this definition , according to point 2
C<S1,...,Sn>, where Si contains Ti (1 ≤ i ≤ n) (§4.5.1).
? contains Integer(Reference). Hence, this makes A<?> supertype of A<Integer>.
You can easily see the point 1 of this definition, includes the subclass definition in itself.
The second part of question , where We have said A<T> extends B<T> , makes it fall under both definitions.
Lastly, we see what inheritance mean. By JLS 8.4.8
A class C inherits from its direct superclass all concrete
methods m (both static and instance) of the superclass for which all
of the following are true: [...]