简体   繁体   中英

Refering a class in a static method

Is there a way to refer java to the current class in a static method? I usually use the word "this", but this is obviously not working.. Any help?

this points to the current instance , not the current class .

For this reason, this will never work in a static context.

If you want to use the current class, you'll have to explicitly name it as 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