定义一个接口,然后实现就是了. 但你的具体意思是?package x;
interface MyConst {
public static final float pi = 3.1415;
}//
package y;
import x.MyConst;
public class ZZZZ implments MyConst {
...
}
interface MyConst {
public static final float pi = 3.1415;
}//
package y;
import x.MyConst;
public class ZZZZ implments MyConst {
...
}
class MyGlobal {
public static int count = 0;
public static int score = 0;
}// in your class
...
MyGlobal.count++;
MyGlobal.score = 100;