Hi Sunil,

On 8/9/2010 8:23 PM, sunil sharma wrote:
> Hi Group
> 
> I got the answer for my question:
> 
> 
>    - Field variables (class members) are automatically initialized to
>    default values
Right
>    - Local variables (method or constructor variables) are
> *not*automatically initialized
Right
>    - Arrays, whether field or local variables, are automatically initialized
>    to the default values of their declared type
  The compiler won't allow you to reference a local array variable that
hasn't been assigned to with an initializer or assignment statement
first. This saves you from the same fate you'd have from using a local C
variable without setting it first (i.e. random garbage that might work a
lot of the time). :-)

-Pete

> 
> 
> 
> 
> Regards
> sunil sharma
> 
> 
> On Mon, Aug 9, 2010 at 12:15 AM, Pete Soper <[email protected]> wrote:
> 
>> Aha. Note that automatics (method-local variables) are not initialized (by
>> the system): an explicit assignment is required. Also, float and double
>> class and instance fields are initialized to 0.0F and 0.0D respectively.
>>
>> -Pete
>>
>>
> 

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