Try somthing like this:

        String[] nameEntered = new String[3];
        String[][] fullNames = new String[3][2];

        for(int i=0; i<3; i++){
//            nameEntered[i] = JOptionPane.showInputDialog("Enter
first and last name of a family member.");
//            fullNames[i] = nameEntered[i].split(" ");

//            or combine the above 2 lines of code
            fullNames[i] =
                    JOptionPane.showInputDialog("Enter first and last
name of a family member.").split(" ");
        }


On Nov 24, 7:50 am, "Ravi NS" <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> This been a Month and I'm Stuck with this function named Split.
>
> split Defines
> The array of strings computed by  splitting this string around matches of
> the given regular expression
>
> Return Type is String which is Split
>
> Here is the Code.
> ******************************************************************************************************************************
> public class JavaArrayProject {
>
>     /**
>      * @param args the command line arguments
>      */
>     public static void main(String[] args) {
>
>         String []fullName = new String [3];
>
>         //  Input for String for FULL NAME
>
>         for ( int i=1; i<=3 ; i++ )
>         {    fullName [i] = JOptionPane.showInputDialog("Please Enter Family
> Member "+
>                     i + " First and Last Name ");
>         }
>
>         // Split Function for Extracting First Name
>         String []firstName = new String [3] ;
>
>         for (int i=1 ;i<=3 ; i++ )
>           firstName[i] = fullName[i].split(" ");
>
> ******************************************************************************************************************************
>
> I'm getting a Error in the last line. My logic on that statement is wrong.
> IDE gives me "incompatible types" and it says
>   found : java.lang.string[]
>   required : java.lang.string
>
> My thoughts are like this..
> Full Name  = Ravi Nazre
> So First Name  is Ravi and Last Name is Nazre.
>
> here fullName= Ravi Nazre
> if i Use
> firstName[ ] = fullName[].split(" ");
>
> It should store First Name
>
> I'm Still wondering what needs to be done here. I want to use Looping
> Structure for Scalability.
> Please help

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to