参考:https://www.cnblogs.com/baiaixing/p/11369514.html

 

  1. for 循环
  2. foreach

如:

1 public class DemoForEach {
2     public static void main(String[] args) {
3         int[] a={0,1,2,3,4,5};
4         for(int x:a){
5             System.out.println(x);
6         }
7     }

  3. jdk自带方法:java.util.Arrays.toString()

import java.util.Arrays;

public class Solution {
    public static void main(String[] args) {
        int[] a = {9, 23, 43, 2, 7, 9};

        System.out.println(Arrays.toString(a));

    }

}

 

相关文章:

  • 2022-02-07
  • 2021-08-03
  • 2021-09-27
  • 2021-06-30
  • 2021-11-30
  • 2021-06-15
  • 2021-11-21
  • 2021-05-24
猜你喜欢
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
  • 2022-02-07
  • 2022-02-07
相关资源
相似解决方案