变量赋值问题class A
{
public int i;//没有赋值不会报错,int类型默认为零
public void show()
{
System.out.printf("%d",i);
}
}
class TestConst
{
public static void main(String[] args)
{
A aa = new A();
aa.show();
//int k;//局部变量编译器是不会自动进行初始化的,java要求所有的局部变量在使用之前必须初始化


//System.out.printf("%d",k);

}
}

相关文章:

  • 2021-11-11
  • 2021-10-08
  • 2021-09-29
  • 2021-11-07
  • 2021-12-04
  • 2022-12-23
猜你喜欢
  • 2021-08-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-05
  • 2022-03-09
  • 2022-01-05
相关资源
相似解决方案