I am new to multi-dimensional arrays and I am trying to create one that accepts a user input (name and home town).I am thinking that a MD array would store the two inputs alongside each other.Here is my code:
import javax.swing.JOptionPane;
public class AlansProg
{
public static void main(
String[]args)
{
String Info[][] = new String[4][2];
for(int row=0;row<4;row++)
{
Info[row] = JOptionPane.showInputDialog("enter name");
}
for(int col=0;col<2;col++)
{
Info[col] = JOptionPane.showInputDialog("enter Home Town");
}
}
}
I am getting this error message :
incompatible types
found:java.lang.string
required:java.lang.String[]
Info[row] = JOptionPane.showInputDialog("enter name");
^
Am I right to think this can be done,or do I need to create seperate arrays?
Cheers...Alan.