volume_mute

What is the the output of the following code snippet?

publish date2020/10/17 05:03:00 GMT+11

volume_mute
public class MyClass {
  public static void main(String[] args) {
    int[] myNumbers = {1, 2, 3, 4};
    System.out.println(myNumbers[1])
  }
}
Missing Word

Correct Answer

2

Explanation

Array positions are 0-based and the code will fetch the second item in the array.  So, the result will be 2


Quizzes you can take where this question appears