首页上一页 1 下一页尾页 1 条记录 1/1页
java从入门到精通 11章11.4例子问题
发表在Java图书答疑
2008-12-18
是否精华
是
否
版块置顶:
是
否
java从入门到精通 11。4的错误信息
package com.wsy;
import static java.lang.System.out;
import java.util.Random;
class Test{
int i=0;
}
public class FinalData {
static Random rand=new Random();
private final int VALUE_1=9;
private static final int VALUE_2=10;
private final Test test=new Test();
private Test test2=new Test();
private final int[]a={1,2,3,4,5,6};
private final int i4=rand.nextInt(20);
private static final int i5=rand.nextInt(20);
public String toString(){
return i4+""+i5+"";
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
FinalData data=new FinalData();
out.print(data.test.i++);
//data.test=new Test();
//data.value2++;
data.test2=new Test();
for(int i=0;i<data.a.length;i++){
//a[i]=9;
}
out.println(data);
out.println("data2");
out.println(new FinalData());
//out.println(data);
}
}
错误提示
Exception in thread "main" java.lang.NoSuchFieldError: i
at com.wsy.FinalData.main(FinalData.java:28)
帮帮忙
package com.wsy;
import static java.lang.System.out;
import java.util.Random;
class Test{
int i=0;
}
public class FinalData {
static Random rand=new Random();
private final int VALUE_1=9;
private static final int VALUE_2=10;
private final Test test=new Test();
private Test test2=new Test();
private final int[]a={1,2,3,4,5,6};
private final int i4=rand.nextInt(20);
private static final int i5=rand.nextInt(20);
public String toString(){
return i4+""+i5+"";
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
FinalData data=new FinalData();
out.print(data.test.i++);
//data.test=new Test();
//data.value2++;
data.test2=new Test();
for(int i=0;i<data.a.length;i++){
//a[i]=9;
}
out.println(data);
out.println("data2");
out.println(new FinalData());
//out.println(data);
}
}
错误提示
Exception in thread "main" java.lang.NoSuchFieldError: i
at com.wsy.FinalData.main(FinalData.java:28)
帮帮忙