有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

python Jython等价于Java代码

我想把下面的Java代码转换成Jython代码。我对Java知之甚少

String name = connection.runReadAction(new ReadActionResult<String>()
{
     public String execute(SystemAccess access) throws Exception
     {
        return access.getTree(SystemTree.Geographic).resolve(path).getDisplayName();
     }
 });

你能帮我做这个任务吗


共 (1) 个答案

  1. # 1 楼答案

    def execute(access):
      return access.getTree(SystemTree.Geographic).resolve(path).getDisplayName()
    
    name = connection.runReadAction(readActionResult=execute)
    

    Jython处理创建匿名内部类的混乱细节