Java – method selector?

I come from Objective-C background In objective - C, you can use the @ selector variable to store references to methods, such as @ selector (terminate) You can then simply "apply" those selectors on the object that perform the methods described by the selector

Now, I have to write something in Java Is there anything similar in Java? Or a solution?

Editor: basically, I'm creating a cli program When I read a command, I have to map the command to some method I wanted to create a dictionary that associates commands with method selectors

Solution

Anonymous inner classes like here

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>