CJCoding With Joseph
15per day
← Back to Question List
Java Code Walkthrough #16

Array First and Last Element

easyArrays

📄 Code

Read carefully — what does this print?
1public class Main {
2 public static void main(String[] args) {
3 int[] nums = {8, 3, 12, 5, 1};
4 System.out.println(nums[0]);
5 System.out.println(nums[nums.length - 1]);
6 System.out.println(nums.length);
7 }
8}

🎯 Your Answer