Array Tutorial
Array Tutorial
Array tutorials
c//Set the value of the fifth element of the array alpha to 35.
alpha[4] = 35;
d//Set the value of the ninth element of the array alpha to the sum of
//the sixth and thirteenth elements of the array alpha
alpha[8] = alpha[5] + alpha[12];
P2 Write a statement that declares a string array initialized with the following
strings:
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" and
"Saturday".
// Declare a string array and initialize
String[] days = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
"Friday" , "Saturday"};
Solution
/**
* This program displays even values
* of array.
*/
public class EvenArray
{
public static void main(String[] args)
{
int[] list = { 2, 5, 16, 18 };
System.out.println();
}
}
Solution
/**
* This program find the largest value
* in an array
*/
Import java.
import java.util.Scanner;
public class PassArray
{
list[i] = console.nextInt();
}
{
max = i;
}
System.out.println();
}
}
import java.util.Scanner;
public class ArraySum
{
public static void main(String[] args)
{
int sum = 0;