this keyword points to current object or global variable.
like
public class ThisTest{
public String str;//global variable;
public ThisTest(String s){
this.str=s; //the reference s is assign to str
}
public void showString(){
System.out.println(str);
}
public static void main(String[] args){
new ThisTest("This String is passed to Constructor to set to
str").showString(); //here we are passing the string in quoted to
constructor and calling the showString to print on the screen.
}
}
On Jan 31, 9:15 am, madhu boppidi <[email protected]> wrote:
> I am new to Java.Actually i am doing right now constructors in constructors
> i am unable to do*' this'* keyword can you any one explain this .
>
> Thanx
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---