 Hello friends, I am Sanjay Gupta. In this video I am going to demonstrate you how super glass can reference subclass. Before starting, you can note my information. You can subscribe my YouTube channel by clicking on bottom right corner. If you want to download my app, you can note Tachymus which is available on Google Play. Now coming on to the topic. First of all I am implementing two classes. First one is class A and I am implementing a simple method that is show inside class A. It will display a simple message A on console while show method of class A will be called. Then class B extends class A. Inside this class I am implementing method with same name that is show and here system.out.println will be displaying B if show method is called. Friends I have implemented two classes A and B. A is superclass and B is subclass. Now third class will be public class test. Inside this class first I am implementing public static void main then for command line arguments string args. Inside this test class and inside main method I am going to create reference of A and I am creating object of A. You can see this is valid. It is showing no errors and I am calling show method. So it has compiled successfully. It is not showing any error. So I have created reference of A and object of A. It is valid. I am executing this code right now. You can see the output. It is showing A on console because object of A class is created and reference is also of A class. Now if I create reference of A and object of B then it is also valid. So friends reference of superclass can receive object of superclass as well as object of subclass. Again I am executing this code. You can see it is showing B. Here show method of B class is called. Now third I am creating reference of class B and object of B is created. This is also correct. No errors are shown here. I am executing this code. You can see the output B is displayed on console. Fourth case is reference of B and I am creating object of A. You can see an error message has occurred here and the error is type mismatch cannot convert from A to B. This cannot be implemented because reference of subclass cannot receive object of superclass. So friends superclass can reference subclass but its vice versa is not possible. Subclass cannot reference object of superclass. So friends with the help of this simple demonstration you might have understood that superclass reference can refer to super and sub but subclass reference can only refer to subclass. Implement this demonstration in your system. If you want to connect with me you can follow my information which is available in front of you. Thank you for watching this video.