Profile cover photo
Profile photo
Naresh Joshi
70 followers -
Don't need it
Don't need it

70 followers
About
Posts

Post has attachment
The most useful command in Git is `git help` which provides us with all the help which we require, Command `git help -a` will give us the complete list of git commands, command `git help -g` will us a list git concepts, command `git help <command>` or `git help <concept>` will give us details of a specific command or concept...

Post has attachment
In Java, instance variables cannot be overridden and do not follow polymorphism because every child class inherits variables and methods from its parent class. Imagine if Java allows variable overriding and we change the type of a variable from int to Object in the child class. It will break any method which is using that variable and because the child has inherited those methods from the parent, the compiler will give errors in the child class.

That's why, if we have a parent reference holding a child class instance and we access a variable from that reference, then the variable is chosen from the reference type.

#java #inheritance

https://www.programmingmitra.com/2018/11/why-instance-variable-of-super-class-is-not-overridden-In-sub-class.html

Post has shared content
In Java, instance variables cannot be overridden and do not follow polymorphism because every child class inherits variables and methods from its parent class. Imagine if Java allows variable overriding and we change the type of a variable from int to Object in the child class. It will break any method which is using that variable and because the child has inherited those methods from the parent, the compiler will give errors in the child class.

That's why, if we have a parent reference holding a child class instance and we access a variable from that reference, then the variable is chosen from the reference type.

#java #inheritance

https://www.programmingmitra.com/2018/11/why-instance-variable-of-super-class-is-not-overridden-In-sub-class.html

Post has shared content
In Java, instance variables cannot be overridden and do not follow polymorphism because every child class inherits variables and methods from its parent class. Imagine if Java allows variable overriding and we change the type of a variable from int to Object in the child class. It will break any method which is using that variable and because the child has inherited those methods from the parent, the compiler will give errors in the child class.

That's why, if we have a parent reference holding a child class instance and we access a variable from that reference, then the variable is chosen from the reference type.

#java #inheritance

https://www.programmingmitra.com/2018/11/why-instance-variable-of-super-class-is-not-overridden-In-sub-class.html

Post has shared content
In Java, instance variables cannot be overridden and do not follow polymorphism because every child class inherits variables and methods from its parent class. Imagine if Java allows variable overriding and we change the type of a variable from int to Object in the child class. It will break any method which is using that variable and because the child has inherited those methods from the parent, the compiler will give errors in the child class.

That's why, if we have a parent reference holding a child class instance and we access a variable from that reference, then the variable is chosen from the reference type.

#java #inheritance

https://www.programmingmitra.com/2018/11/why-instance-variable-of-super-class-is-not-overridden-In-sub-class.html

Post has shared content
In Java, instance variables cannot be overridden and do not follow polymorphism because every child class inherits variables and methods from its parent class. Imagine if Java allows variable overriding and we change the type of a variable from int to Object in the child class. It will break any method which is using that variable and because the child has inherited those methods from the parent, the compiler will give errors in the child class.

That's why, if we have a parent reference holding a child class instance and we access a variable from that reference, then the variable is chosen from the reference type.

#java #inheritance

https://www.programmingmitra.com/2018/11/why-instance-variable-of-super-class-is-not-overridden-In-sub-class.html

Post has attachment
In Java, instance variables cannot be overridden and do not follow polymorphism because every child class inherits variables and methods from its parent class. Imagine if Java allows variable overriding and we change the type of a variable from int to Object in the child class. It will break any method which is using that variable and because the child has inherited those methods from the parent, the compiler will give errors in the child class.

That's why, if we have a parent reference holding a child class instance and we access a variable from that reference, then the variable is chosen from the reference type.

#java #inheritance

https://www.programmingmitra.com/2018/11/why-instance-variable-of-super-class-is-not-overridden-In-sub-class.html
Add a comment...

Post has attachment
Add a comment...

Post has shared content

Post has shared content
Wait while more posts are being loaded