Say, I have a class Alpha
with two formal parameters K and V
.
Now, I want to initialize an object of it with concrete types CK and CV
.
I want to know, what's the difference between
Alpha<CK, CV> alpha = new Alpha<CK, CV>();
and,
Alpha<CK, CV> alpha = new Alpha();
Since, both won't allow me to write or read anything other than what they are declared as. And, since, generics is only for ensuring type safety during compile time, why does it throws warning if I can't do anything wrong with it?