I'm just trying to save a user input as a string into an array using JOptionPane. Pretty simple, I'm sure, but I can;t find anything about it in my books or online. Any help?
for(int index = 0; index < numNames; index ++)
int[] firstName = new int[numNames]; //array of first names
int[] lastName = new int[numNames]; //array of last names
String firstName = JOptionPane.showInputDialog("Enter the first name of person #" + (index + 1) + ");
firstName[index] = keyboard.nextString;
String lastName = JOptionPane.showInputDialog("Enter the last name of person #" + (index + 1) + ");
lastName[index] = keyboard.nextString;
I know that's how I would do it if i were using Scanner and not JOptionPane, but I'm just showing you guys what I want to do. Just basically save the first name into one array and the last name into another array. Thanks for the help!