java - Assign "this" to a variable -


Is there any such way in Java?

In PHP you can type $ someVar = $ this; and in javascript var something = this;

Yes, accepting the name of your class MyClass < / P>

  MyClass thisObject = this;   

Alternatively, if you are in an internal, anonymous class, or something of choice, then the following will be done (given that you have MyClass right now Too)

  MyClass thisObject = MyClass.this;    

Comments

Popular posts from this blog

java - NullPointerException for a 2d Array -

python - Assemble mpeg file unable to play in mediaplayer -

c# - NameSpace Manager or XsltContent to parse aspx page -