In this case: TypeA objA = new TypeB();
I said: TypeB class has to be a super class of TypeA in order to create a object that is TypeA from TypeB. Am I correct?
TypeA can also be an interface that TypeB implements. e.g.
List myList = new ArrayList();
Also, TypeA could be a superclass of a superclass of TypeB, etc.
Or could TypeA be an abstract class which TypeB is a subclass of?
I think it's for interfaces though, like for instance:
List names = new ArrayList<>();