I read that Java provides default values to class properties but not to local variables. Is that correct? If so what is the reason behind this? When you are doing something
The non-technical reason behind may also be the following one:
If you declare a local variable you do this in order to use it. And usage is connected with assigning a value. Therefore, accessing a declared but not initialized variable makes not that much sense - the programmer might simply have forgotten to initialize the variable.
Fields, however, might only be used untill or after a specified point in the object's lifetime. Forcing the programmer to initialize them all would not be good.