Just to get the words clear here in Java.
Primitive types:
This is a declaration right:
int a;//declared but unitialized
Intializations and assignments:
a = 1;//intialization and assignment
a = 2;//this is no longer intialization but still an assignment the 2nd time?
int b = 1;//declaration and intialization = assignment combined?
b = 2;//just assignment because 2nd time?
Class types:
String str;//declaration
str = "some words";//this is also an intialization and assignment?
str = "more words"; //since new object still both intialization and assignment even 2nd time?
The compiler considers a variable initialised when it knows the local variable has been set and can be read without error.
Consider this case, where the compiler cannot determine the
avariable has been initialised.