Instance Member variable are overwritten not overridden java

Please follow and like us:
5

Member variable are not overridden, they are overwritten.

  1. In subclass member variable to be available they need to be either protected/public.
  2. Instance member variable of subclass hide the variable of super class. e.g. parent.variable will call variable of parent and child.variable will call variable of child. See example given below.

    Example 2:

     

Anuj Aneja did his Graduation from a reputed college in India YMCA Institute of Engineering. He is having more than 7 years of experience in various domains like: HealthCare, Telecom, Financial Sector. Till now, He has worked on various technologies like: Java, Python, Hadoop Ecosystem and Spark. He has vast experience in designing both Web application as well as High performance Scalable applications. He has also worked on both SQL and NoSQL database management systems like: Mysql, Oracle, Mongodb.

Please follow and like us:
5

Leave a Reply

Your email address will not be published. Required fields are marked *