I think answer will be compile time error. Child class cannot override a method in parent class if it is more restrictive then parent class method. In parent class method sample has public access, while in child class it has default access. Please correct me if I am wrong. Thanks.
Hi Suman , Rules of overriding is you can't make the method much protected. Private ---> friendly ---> protected ---> public. But in your example public void sample() is overriding with void sample(). That not possible. It gives compiler error.
Joined: Mar 07, 2001
hello suman bingi, I have no problems.... Just do not make it so obvious that other people start noticing it !! sam