Hi Ravi,
split() returns an array.
firstName[i] is a 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
NO.  It will store 'Ravi' and 'Nazre'

you want split() to return its whole array into the firstName [] array
(which could probably use a different name).  Then you want to query
that array and take the individual strings out of it.

hth
mcalex

On Nov 24, 9:50 pm, "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