Write an application that can hold eight integers in an arra

Write an application that can hold eight integers in an array. Display the integers from first to last, and then display the integers from last to first. Save the file as EightInts.java.

Solution

EightInts.java

public class EightInts{
public static void main(String []args){
int [] input = new int[8];
input[0] = 10;
input[1] = 20;
input[2] = 30;
input[3] = 40;
input[4] = 50;
input[5] = 60;
input[6] = 70;
input[7] = 80;
System.out.println(\"Displaying the integers from first to last\");
for(int i=0; i<8; i++){
System.out.println(input[i]);
}
System.out.println(\"Displaying the integers from last to first\");
for(int i=7; i>=0; i--){
System.out.println(input[i]);
}
}
}

Write an application that can hold eight integers in an array. Display the integers from first to last, and then display the integers from last to first. Save t

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site