Some Java:
public class Main {
public int addTwoNumbers(int a, int b) {
return a + b;
}
}
Calling it from ABCL: (defun void-function (param)
(let* ((class (jclass "Main"))
(intclass (jclass "int"))
(method (jmethod class "addTwoNumbers" intclass intclass))
(result (jcall method param 2 4)))
(format "calling addTwoNumbers(2, 4): ~a~%" result)))
Calling it from Clojure: (defn f []
(prn "calling addTwoNumbers(2, 4): " (.addTwoNumbers (Main.) 2 4)))
Note that the Clojure version creates the object, and the ABCL version doesn't do that for you; you still need to instantiate a Main yourself.