This is the nature of OO languages. Interfaces define only a set of method signatures that a particular class should implement. They do not limit the nature of the class (abstract v concrete).
So, when you declare TestInterface ti, in your example Aimplements TestInterface, therefore it is an instance TestInterface. Similarly class B implements TestInterface {...}.
TestInterface ti = new A();
ti = new B();
source
share