When i pasted that code in Netbeans..
Netbeans tells warning in the code :
warning message :
m() in And2 cannot oveeride m() in And; attempting to assign weaker access privileges; was public
you tried to override And's method with And2's method..
And2's method has weaker access (private privileges)..
if you tried to replace the private to public, its mean that you "hiding" the And's method :
i've changed the code as below :
the result is :
And2's m method is executed