I am a pretty decent programmer in Java, however I am new to programming in Clojure.
我是一个相当不错的Java程序员,但我是Clojure编程的新手。
In Java, to force an exit of a program, the code used is System.exit(0)
. Is there any equivalent to this code is Clojure?
在Java中,为了强制退出程序,使用的代码是System.exit(0)。这个代码有没有等同于Clojure?
2 个解决方案
#1
Given that part of the attractiveness of Clojure is that you can use Java class libraries, why not just do:
鉴于Clojure的部分吸引力在于您可以使用Java类库,为什么不这样做:
(System/exit 0)
#2
For a more complete reference, you call any Java classes static methods by specifying
有关更完整的参考,请通过指定调用任何Java类静态方法
(my.package.class/staticMethodName arg1 arg2 etc)
java.lang.*
is loaded automagically for you already though if it where not you could call it with
java.lang。*已经为你自动加载了,但是如果你不能用它来调用它
(java.lang.System/exit 0)
#1
Given that part of the attractiveness of Clojure is that you can use Java class libraries, why not just do:
鉴于Clojure的部分吸引力在于您可以使用Java类库,为什么不这样做:
(System/exit 0)
#2
For a more complete reference, you call any Java classes static methods by specifying
有关更完整的参考,请通过指定调用任何Java类静态方法
(my.package.class/staticMethodName arg1 arg2 etc)
java.lang.*
is loaded automagically for you already though if it where not you could call it with
java.lang。*已经为你自动加载了,但是如果你不能用它来调用它
(java.lang.System/exit 0)