Originally posted by krishna vijay: Also is String="" the same as String=null?
I guess you mean something like String s = "" vs. String s = null. No, these are not the same. In the first case, you let s refer to a String object of length 0, and in the second case you let s refer to no object (null).
You can use this code to test, if it would promote b to an int, the code should not compile:
If int line two, the byte would be changed into an int, the code could not compile, because there is no int-version of the method, and an int wouldn't fit. Test it by outcommenting the third line and what the compiler thinks about it. But it compiles as it is. Please don't be surprised about the output... That would be a different question.
&: Don't mix this ++ up with +=
Because the += operators do promote conversion:
Without the byte to int conversion in this compound operators (+=, *= ...) you would have to cast manually but it doesn't. The output will be the lotto numbers of next week.