I have a problem in accessing the the value of i outside the for loop. At first I want to get 5 Names From User and after that wants to print all of them on the Screen using Arrays. Please Help.
public class Student {
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
String []Name;
Name=new String[5];
System.out.println("Please Enter The Names Of 5 Students: ");
//INPUTS 5 STUDENTS NAME FROM USER
for(int i=0; i<5; i++)
{
System.out.println("Enter The Name of student: "+(i+1));
Name[i]=input.nextLine();
}
//Prints All The Students Names
System.out.println("The Name of student: "+(i+1)+" is : "+ Name[i]);
}
}