如何在 clojure 中调用 java 静态方法? [英] How can I call a java static method in clojure?

查看:24
本文介绍了如何在 clojure 中调用 java 静态方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在 String 类上调用 class.如何访问这个静态方法?

I wish to call class on the String class. How can I access this static method?

推荐答案

您可以使用 (ClassName/methodName arguments) 调用静态方法.

You can call a static method using (ClassName/methodName arguments).

然而 class 不是静态方法,它是一个 java 关键字,在 clojure 中不需要它.要获取与 String 类关联的 Class 对象,只需使用 String.

However class is not a static method, it's a java keyword and you don't need it in clojure. To get the Class object associated with the String class, just use String.

这篇关于如何在 clojure 中调用 java 静态方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆