title: Shall I create a Superclass I will never instance just for casting different subclasses?
body: <p>I just started learning Java and I have this question. Lets say I have classes A and B. I need a variable which could be an object type A or type B. I believe that creating a new Superclass P for A and B will make it. But I will never create an instance of P, I will allways use type A or B objects.</p>
  
  <p>I thought that maybe using an abstract class for P would make more sense, since no instances of it will be ever made, but then I cannot cast A or B to it. Then, is this the only way and the right way to do it?</p>
  
  <p>Thanks in advance.</p>