I have this code:
how can i print out the first input which is contained in index [0] of the arraylist where the 10 inputs are supposed to be stored? any help please?import javax.swing.JOptionPane; public class Hello{ public static void main (String args []){ String[] anArray= new String [10]; for(int i=0; i< anArray.length; i++){ anArray= JOptionPane.showInputDialog(null, "Enter a name:"); } JOptionPane.showMessageDialog(null, anArray[0]); } }
Please point out the wrong codes or kindly fix my code thanks.