首页上一页 1 下一页尾页 1 条记录 1/1页
JAVA从入门到精通P187的代码
发表在Java图书答疑
2009-09-24
是否精华
是
否
版块置顶:
是
否
package com.wsy;
import java.util.Random;
import static java.lang.System.out;
public class FinalStaticData {
/**
* @param args
*/
private static Random rand=new Random();
private final int a1=rand.nextInt(10);
private static final int a2=rand.nextInt(10);
public static void main(String[] args) {
// TODO 自动生成方法存根
FinalStaticData fdata=new FinalStaticData();
out.println("实例化对象调用a1的值:"+fdata.a1);
out.println("实例化对象调用a1的值:"+fdata.a2);
FinalStaticData fdata2=new FinalStaticData();
out.println("重新实例化对象调用a1的值:"+fdata2.a1);
out.println("重新实例化对象调用a2的值:"+fdata2.a2);
}
}
倒数第6行...out.println("实例化对象调用a1的值:"+fdata.a2);
是不是应该是“调用a2的值”...?
小数点后面是a2的..
import java.util.Random;
import static java.lang.System.out;
public class FinalStaticData {
/**
* @param args
*/
private static Random rand=new Random();
private final int a1=rand.nextInt(10);
private static final int a2=rand.nextInt(10);
public static void main(String[] args) {
// TODO 自动生成方法存根
FinalStaticData fdata=new FinalStaticData();
out.println("实例化对象调用a1的值:"+fdata.a1);
out.println("实例化对象调用a1的值:"+fdata.a2);
FinalStaticData fdata2=new FinalStaticData();
out.println("重新实例化对象调用a1的值:"+fdata2.a1);
out.println("重新实例化对象调用a2的值:"+fdata2.a2);
}
}
倒数第6行...out.println("实例化对象调用a1的值:"+fdata.a2);
是不是应该是“调用a2的值”...?
小数点后面是a2的..