0% found this document useful (0 votes)
5 views2 pages

Java Array Basics and Operations

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)
5 views2 pages

Java Array Basics and Operations

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

Array

1)String[] cars = {"Volvo", "BMW", "Ford", "Mazda"};

2)int[] arr = new int[5]; declare & initialize

[Link]([Link]);

Loop through

for (int i = 0; i < [Link]; i++) {

[Link](cars[i]);

for (String i : cars) {

[Link](i);

}
 Array la list bnvu shktex as list mdhe passs krun
String[] array = { "red", "green", "blue" };
List listarray = [Link](array);

 Sum of array

int[] myArray = {1, 5, 10, 25};

int sum = 0;

// Loop through the array elements and store the sum in the
sum variable

for (i = 0; i < [Link]; i++) {

sum += myArray[i];

for (int i = 0; i < [Link](); i++) {


[Link]([Link](i) + " ");

You might also like