I have a little confusion in assignment concept in
java.
What I have understood is compiler only gives error when we try to assign a variable of larger bits to small bit size variable(narrowing) like long to int. And doesn't gives error if we do widening.
But in the example below :-
Compiles fine while being a narrowing.
but this one below :-
gives compiler error while both float and int are 32 bits.
Why is that??