Yes I should have put in something in case the two names were equal and
I forgot to add the () to length because it is a method, but you knew
that right (simple mistake); but other than that, it should work fine.
Stephen
Goky wrote:
// Step 4
If (firstPersonName[0].length > secondPersonName[0].length) {
This part is not correct since firstPersonName[0] is a String and to
get a length of string, you have to call a method - firstPersonName
[0].length(). So initial example is more correct than replied
regarding length call. But there is a cardinal mistake in first
example - lengths are calculated BEFORE names are read - this will
give you false results based on initial values of person1NameInstance
and person2NameInstance.
Also, message in else part is not quite correct if persons have a name
of equal length ;-)
--
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