On May 3, 7:34 am, franzgabriel <[email protected]> wrote:
> hii..
>
> I am curious about your code why after split the string name,  for
> example "Franz Gabriel"
> and after that,
>
> "   int lengthOfFirstNameOfPerson1 = nameArrayForPerson1[0].length
> ();   "
>
> Franz is 5 length assign to integer variable
> "lengthOfFirstNameOfPerson1" ?
Yes, I've just explained it in the original thread.

>
> Franz is string type why Java could save in variable
> "lengthOfFirstNameOfPerson1" type of Integer without casting?
The splitting consists of splitting each string into two parts which
are collected ain an array. Thus nameArrayForPerson1[0] is the first
element of an array of String, it has a length as any other array of
string and this length is an integer, hence you don't need any casting
to affect this length to an integer.
See the Java doc for String, method split.

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