开发者

How do I access "this" with a nested class, in Java?

开发者 https://www.devze.com 2022-12-20 08:53 出处:网络
Consider this example. public class myclass { public void... public int ... private class my_nested_class {

Consider this example.

public class myclass {

public void...
public int ...

    private class my_nested_class {
          Intent i = new Intent(this, List.class);
    }

}

I would like "this" to be myclass. How can I do that? "this.super"? But that doesn't wo开发者_开发技巧rk.


It's myclass.this.

By the way, class names start with a capital letter in Java, you should rename your class MyClass.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号