The rule of thumb on assigning an object of one type to a reference of another type is the “isA” test. If your super class is Fruit and subclass is Banana, you can assign: Fruit obj = new Banana() if Banana isA Fruit.
I suggest you get a good understanding on inheritance and type system in Java.
solved Accessibility of methods from super-class [duplicate]