![java数组的for遍历 java数组的for遍历](https://image.shishitao.com:8440/aHR0cHM6Ly9ia3FzaW1nLmlrYWZhbi5jb20vdXBsb2FkL2NoYXRncHQtcy5wbmc%2FIQ%3D%3D.png?!?w=700&webp=1)
class ArrayDome
{
public static void main(String[] args)
{
int[] arr = {12,51,12,11};
//顺序遍历
for(int x = 0; x < arr.length; x++)
{
System.out.println(arr[x]);
}
//反向遍历
for(int x = arr.length-1; x >= 0; x--)
{
System.out.println(arr[x]);
}
}
}