求数组

int[] a = {1,2,3};

a.length;

求集合

用a.size()

我搞错过了,希望下次不会再错

int[] a ={1,2,3};
  System.out.println(a.length);
  List aList = new ArrayList();
  aList.add("1");
  aList.add("2");
  System.out.println(aList.size());

 

结果

3

2

相关文章:

  • 2021-11-23
  • 2021-11-28
  • 2022-12-23
  • 2021-08-11
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2022-02-02
  • 2022-02-23
相关资源
相似解决方案