122k views
5 votes
What is the output of this code sequence? (Be exact in your answer with spacing) double [] a = {12.5, 48.3, 65.0}; System.out.println(a[1]);

1 Answer

5 votes

Answer:

48.3

Step-by-step explanation:

double [] a = {12.5, 48.3, 65.0}; This line creates the array a, which has three values, those three values can be accesed with the index operator, [].

System.out.println(a[1]); This line prints in the console the value in the array a in the second position, in Java the index inside arrays starts from zero, then puts a new line.

User Mars Redwyne
by
7.7k points