hi Anupam
In this case, the variable str in main method can not access to the class R, because the str in main method belong to main method only.
So, the class R use own variable str as the print result when invoked the default constructor super() in the constructor test.
In you want print "Sub"
If it is not clear,please post again.