how do we access outer class this instance: eg in
Class A {
Class B {
this.helloB();
(A's this).hello()
}
}
how do we access A's this instance in Java
打电话吧
A.this.hello()
By prefixing this
with the class: A.this.hello()
Similarly, when you want to create an instance of B outside of A, you can use a.new B()
(where a instanceof A == true
).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.