大家好,
Java公共类A具有公共属性int a; 当(def a(A.))然后(.a a)时,显示错误A(错误名称:a)。
为什么会这样?
[编辑]
// 使用clojure访问类A的示例
public class A {
public int af() { return 2; }
public int af1(int x) { return x+2; }
public int a = 1;
static public int as;
static public int afs() { return 20; }
static public int afs1(int x) { return x+20; }
}
$ javac A.java
$ clojure -cp "."
user => (import A)
user => (def a (A.))
user => (def x (A.))
user => (def a1 (A.))
user => (.a a1)
1
user => (.a x)
1
user => (.a a)
执行错误(NoClassDefFoundError)在java.lang.ClassLoader/defineClass1 (ClassLoader.java:-2)。
A(错误名称:a)
;; why a is not allowed?