So I'm trying to figure out how to take user input thru the Scanner object, place it in each slot of an array, then read those numbers back to the user plus one. Problem is I have to use a a loop for the read back statement.Heres what I have so far. I figured out the first loop fine with the scanner, but I don't know how to modify each element in the array using a loop.
import java.util.Scanner;
public class Lab7
{
public static void main(String [] Args)
{
Scanner console = new Scanner(System.in);
System.out.println("Enter your 5 integers: ");
int index =0;
final int SIZE = 5;
int[] arrayOfSize = new int[SIZE];
while(index<arrayOfSize.length )
{
arrayOfSize[index]=console.nextInt();
index++;
}
System.out.println("Processing each array element...");
for(int i=0;i<array.length;I++) System.out.printf("index %d is %d plus one%n", i, array[i]+1);