简体   繁体   中英

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

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 work.

It's myclass.this .

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

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM