Calling Java functions from clojure
•
Java
I can use (. Touppercase "good") because "good" is a Java string that has a touppercase method
I can also use (Java. Io. File / separator) in clojure as a way to call Java functions
But why can't I call (java.lang / object wait 3) or (java.lang.system / println "Hi")?
>We can't use all the Java functions in clojure? > If not, are there rules to call them? If so, where are the references for these functions?
Solution
You can use all Java functions in clojure See clojure's great Java interop page
In particular, you only need to get the correct syntax, depending on what type of Java construct you are dealing with In Java Execute println method on static member "out" of lang. system:
(.println (System/out) "hi")
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
二维码