(module test mzscheme (require "jclass.ss") (define bar (jclass (constructor () (printf "In the constructor!\n")) (private-field xyz) (public-field tuna 10) (public-field hello 30) (public-method (show-tuna) (printf "Tuna = ~a\n" tuna)) (private-method (foo a b) (+ a b)) (public-method (bar a b) (+ a b)) )) (define bar2 (jclass extends bar (constructor (x) (begin (printf "In bar2 constructor ~a\n" x))) (override-method (bar a b) (- a b)))) (define bar3 (jclass extends bar2 (constructor (x y) (super-constructor y) (printf "In bar3 constructor\n")))) (define f (new bar)) (printf "~a\n" (send f bar 2 3)) (define g (new bar2 5)) (define g1 (new bar3 5 9)) (printf "~a\n" (send g bar 2 3)) (printf "~a\n" (f . -> . bar 2 3)) (send f show-tuna) (set-field tuna f 20) (send f show-tuna) (define int1 (jinterface x1 x2)) (printf "x1\n") (define int2 (jinterface extends (int1) x3)) (printf "x2\n") (define jarb (jclass implements (int2) (constructor () (void)) (public-method (x1) (void)) (public-method (x3) (void)) (public-method (x2) (void)) )) (printf "x3\n") )