Java Data Type Default Values

When a field is declared, It's not always necessary to assign a value. Fields that are declared but not initialized will be set to a reasonable default by the compiler. This default will be zero or null, depending on the data type.

The following are the default values for the above data types:


Local variables are slightly different; the compiler never assigns a default value to an uninitialized local variable. If you cannot initialize your local variable where it is declared, make sure to assign it a value before you attempt to use it. Accessing an uninitialized local variable will result in a compile-time error.


Comments

Popular posts from this blog

I get wrong characters when retreiving the message body of an email using TIdIMAP4.UIDRetrieveTextPeek2()

How to drop the all the 1's in a correlation matrix

Today Walkin 14th-Sept