hi,

the first two lines is to separate it with there first name and last
name using the split() method of a String class, and store it to the
another array variable.

the second two lines is to get the length of the new array from the
"first two lines" by using length() method.



On Jan 23, 1:38 pm, Srini S <[email protected]> wrote:
> Hi,
>
> The homework is to accept three names (first and last) and find out
> the longer first name. Can someone explain me the following lines
> which is on the hint:
>
> // Get the first name from a name string using split() instance (non-
> static) method
> String[] nameArrayForPerson1 = person1NameInstance.split(" ");
> String[] nameArrayForPerson2 = person2NameInstance.split(" ");
>
> // Get the lengths of strings using length() instance (non-static)
> method
> int lengthOfFirstNameOfPerson1 = nameArrayForPerson1[0].length();
> int lengthOfFirstNameOfPerson2 = nameArrayForPerson2[0].length();
>
> Thanks,
> Srini.

--~--~---------~--~----~------------~-------~--~----~
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