Initialization vs assigment

int a;
This is declaration

int a = 10;
This is initialization

int a;
constructor(){
a=10;
}
this is assignment

Am i right ?

this is declaration and initialisation, a has a garbage value when declared.

yes

yes

1 Like

thanks a lot…

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.