Bilal Ali wrote:
What and why will be the result of the following piece of code:
please use code tag to post your code. and also post the program with good format . Coming to your question , you will get the answare "Test1" due to shadowing of the variable
put your code inside proper format anyways i will give you the answer i guess you wanted to refer to class variable but instead your referring to method variable you could have refered to class variable if you used the different name over here but you used the same name as method name to refer to class variable in such situation just use
this.<variable name>=<local method variable name> in your case here
this.s=s;
this refers to current object and you are saved from ambiguity! got it any more queries do post it here