+ 1
Initialization and declaration whats the difference please?
4 Respostas
+ 3
int a; // declaration
a = 5; // initialization
int b = a; // declaration with initialization
declaration consists of any modifier(s), type, and variable name.
initialization, simply put, means that the variable has been set at least once.
https://stackoverflow.com/questions/2614072/java-define-terms-initialization-declaration-and-assignment
https://teamtreehouse.com/community/what-is-the-difference-between-declaring-a-variable-and-initializing-a-variable
+ 2
thanks i think i get it does this look right?
int x; < declaration
x = 5 ; < initialization
x = 10; < assignment as x is already initialized
+ 2
thanks agin for your help 👍
+ 1
👍