I want to enter in 3 names into the array. Then I want to access the position of the second character in the second name.
First of all I get an out of bounds exception in line 13. Also, the second for loop I know is completely off so excuse that.
Why am I getting the exception and how would I access certain character positions in certain strings?
class Names
{
public static void main(String[]args)
{
int index;
String names[];
names = new String [3];
for(index = 1; index <= names.length; index++)
{
System.out.println("Enter name " + index);
names[index] = EasyIn.getString();
}
for(index = 0; index < names.length; index++)
{
System.out.println(names[1][2]);
}
}
}