| Forever。 发表于 2012-6-26 00:08 ![]() 你这样写有结果了才怪…… 你把system……写在方法体外面你自己试试看行不行 ...
童鞋果然心细,是我大意了,没细看方法体.嘿嘿,写到主函数外面去了.想拿到3只有传进对象了.
 class Test1
 {
 int x=3;
 public static void main(String[] args)
 {
 int x=012;//012这是一个八进制的整数.所以是10.x是局部变量在它所属的代码块中打印的是它本身.
 
 System.out.println(x);//结果为10,求解;已经用很多数据测试;但找不规律;
 Test1 t = new Test1();
 System.out.println(t.x);
 }
 
 }
 
 |