June 2018
Beginner
722 pages
18h 47m
English
After a variable is declared and before it can be used, a value has to be assigned to it. As we have mentioned in the Variable declaration, definition, and initialization section, a local variable must be initialized or assigned a value explicitly. For example:
int x;int y = 0;x = 1;
But if the variable is declared as a class field (static), an instance (non-static) property, or an array component and is not initialized explicitly, it is initialized automatically with a default value. The value itself depends on the type of the variable:
Read now
Unlock full access