CJCoding With Joseph
15free / daySign inCreate account
Back to Code Walkthrough

Array First and Last Element

Java code walkthrough · Question 16
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