Hi,

I am trying out the homework for Java Arrays. I am getting an error with
the split statement. I have given the code that I am using below. Could you
please let me know what is wrong with my approach?

import javax.swing.JOptionPane;

public class LongestName {

    public static void main(String[] args) {
    //int[] num = new int[10];
    String [] personfull = new String[3];
    String [] firstname = new String[3];
    int counter;
    int max = 0;
    int totalnumber = 3;

    for (counter = 0;counter < totalnumber;counter++){
        personfull[counter] = JOptionPane.showInputDialog("Enter the name");
        firstname[counter] = personfull[counter].split(" ");
    }

    for(counter = 0;counter < totalnumber; counter++){
        System.out.println(personfull[counter]);
        System.out.println(firstname[counter]);
    }


    }
}

Thank you.

Regards,
Ravishankar Rajagopalan

-- 
You received this message because you are subscribed to the Google Groups 
"JPassion.com: Java Programming" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/jpassion_java?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to