public static void mainStringargsint nums=new int3;forint i=1;inumslength;i++numsi=i2;forint i=0;inumslength;i++Systemoutprintnumsi;
The output of this code would be:
0 2 4
Explanation:
- An array of size 3 is created with all elements initialized to 0 by default.
- The first loop starts from index 1 and goes up to the second last index (since the last index is already initialized to 0), and sets each element to twice the value of its index.
- The second loop prints out all elements of the array.
- Therefore, the output would be 0 2 4.
原文地址: https://www.cveoy.top/t/topic/fFHP 著作权归作者所有。请勿转载和采集!