Why the o/p s 5 0.
Because local variable takes precedence of instance variable.
In this line (System.out.println(myst); //1
it prints local variable myst....so it prints 5
myst=myst; //2
in this line local variable is assign to itself
....if you want to assign to instance variable use this(this.myst=myst)
in this line System.out.println(a.myst);
it prints instance variable with default value 0
Hope you clear now