What happens in JAVA about using = = and println

Integer a = 1;
Integer b = 2;
Long c = 3L;
/ / c = a compiler error will result in the error that int cannot be converted to long
System.out.println (compiled normally, resulting in true

Why?
I know that when int and long add up, they both turn into long,. Does that have anything to do with this?
for System.out.println (centering = (aquib))
will first unpack an and b into int, and then add them. The final result should be that an int,c is a long,. First of all, they are of different types, and the addresses of IntegerCache and LongCache must be different.

also, for "in-depth understanding of JVM", what does it mean that the "wrapper class" = = "the wrapper class"s" = = "operation will not automatically unpack without an arithmetic operation"

Mar.12,2021

c=a+b is an abbreviation for c = a.intValue () + b.intValue (). The result of adding two int or int, must be displayed and converted to long. For example, c = (long) (aquib). Jvm optimizes some integers when comparing whether two reference points to the same object. I think the object is-128to128s. If two integers are the same, they point to the same object. For example, Integer a = 12; Integer bread12; astatb is true.


c==(a+b)a,b,c
c=Long.longValue(c);long
abInteger.intValue(a);int
c==(a+b)true

the "= =" operation of the wrapper class will not unbox automatically without an arithmetic operation.
above < br = (aqb) has a sign that is an arithmetic operator, so it will be automatically unpacked
. If it is a cymbal, it will not be unpacked without an arithmetic operator, and a compilation error will be reported

.
Menu