In first code: this refers to object of keyevent1 class.
In second code: this refers to object of Button1 class.

The best way to identify this type is:

Code:

SySystem.out.println(this.getClass());

04-01-2011, 06:15 PM

ozzyman

I think you've confused this for referring to Objects like in JavaScript.

as lovelesh has explained, this refers to the current Class, not the object container.

04-02-2011, 11:02 AM

anoop_mig25

Quote:

Originally Posted by lovelesh

In first code: this refers to object of keyevent1 class.
In second code: this refers to object of Button1 class.

The best way to identify this type is:

Code:

SySystem.out.println(this.getClass());

Quote:

Originally Posted by ozzyman

I think you've confused this for referring to Objects like in JavaScript.

as lovelesh has explained, this refers to the current Class, not the object container.

thanks both of u for reply but i didn`t get first one . can u explain me a lot dipper although i think i got second one write but it may be an hook so can u please provide me link for tutorial/video link were i can clear my concepts

04-02-2011, 06:32 PM

ozzyman

There's not much to it, here's a simple tutorial about the this keyword: