I have a problem invoking the multiple arity function printf
on java.io.PrintWriter
(specifically, System.out
).
user=> (.printf System/out (into-array Object ["foo"]))
IllegalArgumentException No matching method found: printf for class java.io.PrintStream
clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:53)
user=>
Your code attempts to call method printf(Object[] arg)
of java.io.PrintStream
class. But such method doesn't exist. Propably you want to call this one printf(String format, Object ... args)
like this:
(.printf System/out "arg1: %s" (into-array Object ["foo"]))
=> #<PrintStream java.io.PrintStream@708e4544>
arg1: foo
Here #<PrintStream java.io.PrintStream@708e4544>
is an object returning from printf
.