String is not a primitive data type. It is an array of characters and
can be an object hence it is capitalized.

int can also be 'capitalized' to Integer. The difference would be that
Integer is an object and int is a primitive data type.



On 3/28/10, miga <[email protected]> wrote:
>
>
> On Mar 28, 3:39 am, [email protected] wrote:
>>  It helps clarify a lot; thanks.  I do have a couple of questions though:
>>
>> Why does the class 'string' have to have a capitalized 'S' whereas the
>> class 'int' does not?
> All classes begin with a capital letter; int is not a class, it is a
> convenient wrapper to class Integer. Revise first lab, where all of
> this is explained. You should also really study the resources.
>>
>> Also, what does the open/closed parens indicate:
>> 'args[counter].length()' and '
>> maxName.length()' in this section?
> It is the length of the String maxName. To get the length of a String,
> you call the length() method. Revise class String,
>> Why isn't it used in the surrounding for/else statement?
> Because, here you deal with an array. To get the size of an array, you
> call its property (aka parameter) length. See class Array in the API.
> So no parentheses a parameter of a class, with parentheses a method of
> a class.
>>
>>     String maxName = "";
>>     System.out.println("args" + args.length);
>>         for(int counter=args.length - 1; counter > 3; counter= counter
>> -2){
>>        System.out.println(counter);
>>            if (args[counter].length() > maxName.length()){
>>                 maxName=args[counter -1];
>>         System.out.println("maxName= " + maxName);
>>             } else {
>>                 maxName=args[counter-3];
>>         System.out.println("maxName: " + maxName);
>>         }
>>     }
>>
>> Last, why does the program calculate the first age if the counter is
>> always above 3?
>>
>> String maxName = "";
>>     System.out.println("args" + args.length);
>>         for(int counter=args.length - 1; counter > 3; counter= counter
>> -2){
>>        System.out.println(counter);
>>            if (args[counter].length() > maxName.length()){
>>                 maxName=args[counter -1];
>>         System.out.println("maxName= " + maxName);
>>             } else {
>>                 maxName=args[counter-3];
> because here we read the value of args[counter-3]; that is 0 when you
> begin, that is the first number.
> You should make a distinction between the value of the counter, and
> the value of the index you really read; here you have index=counter-3.
> Advice: it helps sometimes to take a sheet of paper, and manually
> replace the parameter by the real value while changing the value of
> the counter from the beginning, not just as you think it works, but
> really as you have written it.
>>         System.out.println("maxName: " + maxName);
>>         }
>>     }
>>
>> Cheers.
>> Rob
>
> Michèle
>
> --
> 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
>
> To unsubscribe from this group, send email to
> javaprogrammingwithpassion+unsubscribegooglegroups.com or reply to this
> email with the words "REMOVE ME" as the subject.
>

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

To unsubscribe from this group, send email to 
javaprogrammingwithpassion+unsubscribegooglegroups.com or reply to this email 
with the words "REMOVE ME" as the subject.

Reply via email to