Following code will not compile because of line 4 and 6. I was expecting line #7 will also give compile time error because it is having long (64 bit) value which is bigger than float integral value 32-bit. Why line #7 working correct?
Whether we think a long is bigger than a float or vice versa makes little difference; the Java® Language Specification decrees it, so long→float is a permissible widening primitive conversion.
Somebody has to make decisions like that when writing a language; the more specific the decision, the more robust the language will be.
posted 3 years ago
Wow.... Good to know that..
Climb the rope! CLIMB THE ROPE! You too tiny ad:
Devious Experiments for a Truly Passive Greenhouse!