0% found this document useful (0 votes)
38 views1 page

Java Array Element Access Example

This Java code defines a main method that declares and initializes a float array with 10 elements. It then uses a for loop to print out each element of the array using its index. The output shows the values of each element correspond to their index multiplied by 100.

Uploaded by

Hid Den
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views1 page

Java Array Element Access Example

This Java code defines a main method that declares and initializes a float array with 10 elements. It then uses a for loop to print out each element of the array using its index. The output shows the values of each element correspond to their index multiplied by 100.

Uploaded by

Hid Den
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

float

+ anArray[6]);
[Link]("Element at index 7: "
+ anArray[7]);
[Link]("Element at index 8: "
+ anArray[8]);
[Link]("Element at index 9: "
+ anArray[9]);
}
}

The output from this program is:

Element at index 0: 100


Element at index 1: 200
Element at index 2: 300
Element at index 3: 400
Element at index 4: 500
Element at index 5: 600
Element at index 6: 700
Element at index 7: 800
Element at index 8: 900
Element at index 9: 1000

You might also like