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

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -