← Back to Question List
Java Code Walkthrough #16
Array First and Last Element
📄 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}