有关程序运行出现错误的问题,求高手帮忙解决!!
class Equal{
int i = 100;
int j = 100;
Integer objI = new Integer(i);
Integer objJ = new Integer(j);
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (this == obj) {
return true;
}
if (this.getClass() != obj.getClass()) {
return false;
}
Equal c = (Equal) obj;
return this.equals(c);
}
public static void main(String[] args){
System.out.println("i == j:= " + (i == j));
System.out.println("objI == objJ:= " + (objI == objJ));
System.out.println("objI == objJ:= " + (objI.equals(objJ));
}}
运行时出现了无法从静态上下文中引用非静态变量的错误,哪位高手帮忙解释下,顺便提供下解决方案,不胜感激。