1、new对象型,并指定初始长度

int[ ] arr = new int[5]; // 创建长度为5 的数组

2、直接初始化特定值型

int[ ] arr = {1,2,3,4};

3、new对象+初始化值型

int[ ] arr = new int[]{1,2,3,4};

相关文章:

  • 2022-12-23
  • 2021-10-04
  • 2022-01-19
  • 2022-02-22
  • 2022-12-23
猜你喜欢
  • 2021-06-16
  • 2022-12-23
  • 2022-02-12
  • 2022-02-11
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案