Joshua
Joshua

Reputation: 19

Writing to an element in an Array

If I have an integer array of monthSales, obviously the length of 12, what does it mean to "write a statement that writes to standard output the element corresponding to October"?

Is writing to an element in an array different from assigning said element to a previously defined variable?

Upvotes: 0

Views: 55

Answers (1)

vikiiii
vikiiii

Reputation: 9456

Since the array index starts from 0, October Month will corresponds to index 9

System.out.println("Your sales for month of October is" + monthSales[9]);

Upvotes: 3

Related Questions