Why is the output different in the below case even when, the variable has been overridden?
public class A { int a = 500; void get() { System.out
No the variable is not overridden. ob.a print the a variable of B class. ob.get() searches for the get method in B class.when it does not gets there it then searches the parent class and executes it.
ob.a
ob.get()