I can use (.toUpperCase "GOOD") in clojure, as "GOOD" is java string, and java string has toUpperCase method.
I also can use (java.io.File/separator) from clojure as a way of calling java functions.
But, why can't I call (java.lang/Object wait 3) or (java.lang.System/println "hi")?
You can use all Java functions from Clojure. See the great page on Clojure's Java interop.
In particular, you just need to get the syntax right depending on exectly what sort of Java construct you are dealing with, e.g. executing the println method on the static member "out" from java.lang.System:
(.println (System/out) "hi")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With